-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aabf57a
Showing
104 changed files
with
14,081 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
default.profraw | ||
Package.resolved | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
/*.sublime-project | ||
/*.sublime-workspace |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This file is a list of the people responsible for ensuring that patches for a | ||
# particular part of SourceKit-LSP are reviewed, either by themselves or by | ||
# someone else. They are also the gatekeepers for their part of Swift, with the | ||
# final word on what goes in or not. | ||
|
||
# Lines starting with '#' are comments. | ||
# Each line is a file pattern followed by one or more owners. | ||
# Order is important. The last matching pattern has the most precedence. | ||
|
||
# Owner of anything in SourceKit-LSP not owned by anyone else. | ||
# N: Ben Langmuir | ||
# E: blangmuir@apple.com | ||
* @benlangmuir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
By submitting a pull request, you represent that you have the right to license | ||
your contribution to Apple and the community, and agree by submitting the patch | ||
that your contributions are licensed under the [Swift | ||
license](https://swift.org/LICENSE.txt). | ||
|
||
--- | ||
|
||
Before submitting the pull request, please make sure you have [tested your | ||
changes](https://github.com/apple/swift/blob/master/docs/ContinuousIntegration.md) | ||
and that they follow the Swift project [guidelines for contributing | ||
code](https://swift.org/contributing/#contributing-code). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Editor Integration | ||
|
||
This document contains information about how to configure an editor to use SourceKit-LSP. If your editor is not listed below, but it supports the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP), see [Other Editors](#other-editors). | ||
|
||
## Visual Studio Code | ||
|
||
To use SourceKit-LSP with Visual Studio Code, you will need the [SourceKit-LSP | ||
Visual Studio Code extension](vscode). Documentation for [Building and Installing](vscode/README.md#building-and-installing-the-extension) is in the extension's README. There is also information about [Configuration](vscode/README.md#configuration). The most common settings are listed below. | ||
|
||
After installing the extension, settings for SourceKit-LSP can be found in `Preferences > Settings` under | ||
`Extensions > SourceKit-LSP` or by searching for the setting prefix | ||
`sourcekit-lsp.`. | ||
|
||
* `sourcekit-lsp.serverPath`: The path to sourcekit-lsp executable | ||
* `sourcekit-lsp.toolchainPath`: The path to the swift toolchain (sets `SOURCEKIT_TOOLCHAIN_PATH`) | ||
|
||
## Sublime Text | ||
|
||
Before using SourceKit-LSP with Sublime Text, you will need to install the LSP package from Package Control. To configure SourceKit-LSP, open the LSP package's settings. The following snippet should be enough to get started with Swift. | ||
|
||
You will need the path to the `sourcekit-lsp` executable and the Swift toolchain for the "command" and "env" sections. | ||
|
||
```json | ||
{ | ||
"clients": | ||
{ | ||
"SourceKit-LSP": | ||
{ | ||
"enabled": true, | ||
"command": [ | ||
"<path to sourcekit-lsp>" | ||
], | ||
"env": { | ||
"SOURCEKIT_TOOLCHAIN_PATH": "<path to toolchain>", | ||
}, | ||
"languages": [ | ||
{ | ||
"scopes": ["source.swift"], | ||
"syntaxes": [ | ||
"Packages/Swift/Syntaxes/Swift.tmLanguage", | ||
], | ||
"languageId": "swift" | ||
}, | ||
{ | ||
"scopes": ["source.c"], | ||
"syntaxes": ["Packages/C++/C.sublime-syntax"], | ||
"languageId": "c" | ||
}, | ||
{ | ||
"scopes": ["source.c++"], | ||
"syntaxes": ["Packages/C++/C++.sublime-syntax"], | ||
"languageId": "cpp" | ||
}, | ||
{ | ||
"scopes": ["source.objc"], | ||
"syntaxes": ["Packages/Objective-C/Objective-C.sublime-syntax"], | ||
"languageId": "objective-c" | ||
}, | ||
{ | ||
"scopes": ["source.objc++"], | ||
"syntaxes": ["Packages/Objective-C/Objective-C++.sublime-syntax"], | ||
"languageId": "objective-cpp" | ||
}, | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Other Editors | ||
|
||
SourceKit-LSP should work with any editor that supports the Language Server Protocol](https://microsoft.github.io/language-server-protocol/) | ||
(LSP). Each editor has its own mechanism for configuring an LSP server, so consult your editor's | ||
documentation for the specifics. In general, you can configure your editor to use SourceKit-LSP for | ||
Swift, C, C++, Objective-C and Objective-C++ files; the editor will need to be configured to find | ||
the `sourcekit-lsp` executable (see the top-level [README](https://github.com/apple/sourcekit-lsp) for build instructions), which | ||
expects to communicate with the editor over `stdin` and `stdout`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Set default behavior to automatically normalize line endings. | ||
* text=auto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
out | ||
node_modules | ||
.vscode-test/ | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// A launch configuration that compiles the extension and then opens it inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/**/*.js" | ||
], | ||
"preLaunchTask": "npm: watch" | ||
}, | ||
{ | ||
"name": "Extension Tests", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionTestsPath=${workspaceFolder}/out/test" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/test/**/*.js" | ||
], | ||
"preLaunchTask": "npm: watch" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"files.exclude": { | ||
"out": false // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true // set this to false to include "out" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
out/test/** | ||
out/**/*.map | ||
src/** | ||
.gitignore | ||
tsconfig.json | ||
vsc-extension-quickstart.md | ||
tslint.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# SourceKit-LSP for Visual Studio Code | ||
|
||
This extension adds support to Visual Studio Code for using SourceKit-LSP, a | ||
language server for Swift and C/C++/Objective-C languages. | ||
|
||
**Note**: SourceKit-LSP is under heavy development and this should be considered | ||
a preview. Users will need to separately provide the `sourcekit-lsp` executable | ||
as well as a Swift toolchain. | ||
|
||
## Building and Installing the Extension | ||
|
||
Currently, the way to get the extension is to build and install it from source. | ||
You will also need the `sourcekit-lsp` language server executable and a Swift | ||
toolchain. For more information about sourcekit-lsp, see [here](https://github.com/apple/sourcekit-lsp). | ||
|
||
**Prerequisite**: To build the extension, you will need Node.js and npm: https://www.npmjs.com/get-npm. | ||
|
||
The following commands build the extension and creates a `.vsix` package in the `out` directory. | ||
|
||
``` | ||
$ cd Editors/vscode | ||
$ npm run createDevPackage | ||
``` | ||
|
||
You can install the package from the command-line if you have the `code` executable on your `PATH`: | ||
|
||
``` | ||
code --install-extension out/sourcekit-lsp-vscode-dev.vsix | ||
``` | ||
|
||
Or you can install from within the application using the `Extensions > Install from VSIX...` command from the command palette. | ||
|
||
### Developing the Extension in Visual Studio Code | ||
|
||
As an alternative, you can open the extension directory from Visual Studio Code and build it from within the application. | ||
|
||
1. Run `npm install` inside the extension directory to install dependencies. | ||
2. Open the extension directory in Visual Studio Code. | ||
3. Hit `F5` to build the extension and launch an editor window that uses it. | ||
|
||
This will start debugging a special instance of Visual Studio Code that will have "[Extension Development Host]" in the window title and use the new extension. | ||
|
||
There is extensive documentation for developing extensions from within Visual Studio Code at https://code.visualstudio.com/docs/extensions/overview. | ||
|
||
## Configuration | ||
|
||
Settings for SourceKit-LSP can be found in `Preferences > Settings` under | ||
`Extensions > SourceKit-LSP` or by searching for the setting prefix | ||
`sourcekit-lsp.`. | ||
|
||
* Server Path: The path of the sourcekit-lsp executable | ||
* Toolchain Path: The path of the swift toolchain (sets `SOURCEKIT_TOOLCHAIN_PATH`) | ||
|
||
The extension will find the `sourcekit-lsp` executable automatically if it is in | ||
`PATH`, or it can be provided manually using this setting. |
Oops, something went wrong.