Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
Re-organize since there is now a Swift language server
Browse files Browse the repository at this point in the history
  • Loading branch information
RLovelett committed Nov 26, 2016
1 parent 475d17e commit 7268c6b
Show file tree
Hide file tree
Showing 34 changed files with 118 additions and 1,092 deletions.
61 changes: 36 additions & 25 deletions vscode-swift-language/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@

# Created by https://www.gitignore.io/api/visualstudiocode,osx,node,linux

### VisualStudioCode ###
out/
server/
*.vsix
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json

### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Node ###
Expand Down Expand Up @@ -70,9 +72,15 @@ jspm_packages
# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz


### Linux ###
*~
Expand All @@ -85,3 +93,6 @@ jspm_packages

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
76 changes: 61 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,67 @@
# Swift for Visual Studio Code

This extension adds rich language support for the Swift language to VS Code. These features are
provided by the Swift framework itself through
[SourceKit](https://github.com/apple/swift/tree/master/tools/SourceKit)
and [SourceKitten](https://github.com/jpsim/SourceKitten).
This extension adds rich language support for the Swift language to VS Code. These features are provided by the Swift framework itself through [SourceKit](https://github.com/apple/swift/tree/master/tools/SourceKit) and [SourceKitten](https://github.com/jpsim/SourceKitten).

![https://github.com/RLovelett/vscode-swift/blob/master/vscode-swift-language/images/vscode-swift-documentation.gif?raw=true](https://github.com/RLovelett/vscode-swift/blob/master/vscode-swift-language/images/vscode-swift-documentation.gif?raw=true)
Currently the extension provides rudimentary support for:

## Development setup
- run npm install inside the `vscode-swift-language` and `vscode-swift-language-server` folders
- open VS Code on `vscode-swift-language` and `vscode-swift-language-server`
- Completion lists
- Symbol resolution

## Developing the server
- open VS Code on `vscode-swift-language-server`
- run `npm run compile` or `npm run watch` to build the server and copy it into the `vscode-swift-language` folder
- to debug press F5 which attaches a debugger to the server
Future support for:

## Developing the extension/client
- open VS Code on `vscode-swift-language`
- run F5 to build and debug the extension
- Document Highlights: highlights all 'equal' symbols in a Swift document.
- Hover: provides hover information for a symbol selected in a Swift document.
- Signature Help: provides signature help for a symbol selected in a Swift document.
- Find References: find all project-wide references for a symbol selected in a Swift document.
- List Workspace Symbols: list all project-wide symbols.
- CodeLens: compute CodeLens statistics for a given Swift document.
- Rename: project-wide rename of a symbol.
- Debugger
- [Swift Package Manger](https://swift.org/package-manager/)

## Features

### Completion Lists

Use completion lists to find out about available standard library types and function signatures.

![Struct Def](http://i.giphy.com/26gJAJzxzZDsVEs24.gif)

Do the same for your own custom types. Including documentation comments.

![Struct Docs](http://i.giphy.com/l0HlzNmlfLl7fyc0g.gif)

## Requirements

This extension requires Swift to be installed on your system. More specifically it requires [SourceKit](https://github.com/apple/swift/tree/master/tools/SourceKit) and [SourceKitten](https://github.com/jpsim/SourceKitten) to be available as well.

[Currently, SourceKit and by extension SourceKitten, do not compile on Linux.](https://github.com/jpsim/SourceKitten/pull/223) This limits the extension to only work on macOS. This is not expected to be the long-term solution. In fact running on Linux was the whole reason why I started this extension.

The extension expects [`v0.13.0` of SourceKitten](https://github.com/jpsim/SourceKitten/releases/tag/0.13.0) to be installed at `/usr/local/bin/sourcekitten`.

With [homebrew]() this can easily be achieved by running `brew install sourcekitten`.

## Extension Settings

* `sourcekitten` path

## Known Issues

- Does not run on Linux

## Release Notes
For detailed release notes see: [Releases](https://github.com/RLovelett/vscode-swift/releases)

### 0.0.5

* Completions use snippet formatting for placeholders, allows the cursor to tab between placeholders
* Completions index against all swift files in the workspace
* Bug fixes

### 0.0.3

* Allow configuring sourceKitten install location

### 0.0.2

Preview release of the extension
File renamed without changes
File renamed without changes
11 changes: 6 additions & 5 deletions vscode-swift-language/package.json → package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
],
"engines": {
"vscode": "^1.0.0"
"vscode": "^1.6.0"
},
"categories": [
"Languages"
Expand Down Expand Up @@ -59,14 +59,15 @@
},
"scripts": {
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"compile": "node ./node_modules/typescript/bin/tsc -w",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"typescript": "^1.8.5",
"vscode": "^0.11.0"
"@types/node": "^6.0.45",
"typescript": "^2.0.3",
"vscode": "^1.0.0"
},
"dependencies": {
"vscode-languageclient": "~2.3.0"
"vscode-languageclient": "~2.5.0"
}
}
20 changes: 12 additions & 8 deletions vscode-swift-language/src/extension.ts → src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
'use strict';

import * as Path from 'path';
import * as net from 'net';

import { workspace, ExtensionContext } from 'vscode';
import { LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient';
import { workspace, ExtensionContext, Uri } from 'vscode';
import { ServerOptions, Executable, LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: ExtensionContext) {
let serverModule = context.asAbsolutePath(Path.join('server', 'server.js'));
let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] };
let serverOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
let run: Executable = {
command: "/Users/ryan/Source/langserver-swift/.build/debug/LanguageServer"
};
let debug: Executable = {
command: "/Users/ryan/Library/Developer/Xcode/DerivedData/langserver-swift-gellhgzzpradfqbgjnbtkvzjqymv/Build/Products/Debug/LanguageServer"
};
let serverOptions: ServerOptions = {
run: run,
debug: debug
};

// client extensions configure their server
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions vscode-swift-language/tsconfig.json → tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"target": "es5",
"moduleResolution": "node",
"outDir": "out",
"noLib": true,
"sourceMap": true,
"rootDir": "."
"sourceMap": true
},
"exclude": [
"node_modules",
Expand Down
2 changes: 0 additions & 2 deletions vscode-swift-language-server/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions vscode-swift-language-server/.vscode/launch.json

This file was deleted.

13 changes: 0 additions & 13 deletions vscode-swift-language-server/.vscode/settings.json

This file was deleted.

30 changes: 0 additions & 30 deletions vscode-swift-language-server/.vscode/tasks.json

This file was deleted.

65 changes: 0 additions & 65 deletions vscode-swift-language-server/README.md

This file was deleted.

Loading

0 comments on commit 7268c6b

Please sign in to comment.