Skip to content

[5.1] Update with changes from master #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 122 commits into from
Aug 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
b57599f
Add instructions for Theia Cloud IDE
satishbabariya Mar 21, 2019
eb8ea96
Implement document symbol request
Trzyipolkostkicukru Apr 14, 2019
942ed5d
Port SKSupport to Windows
gmittert Apr 18, 2019
4d30353
Merge pull request #99 from gmittert/SKSupportWin
benlangmuir May 3, 2019
550e376
Add DocumentSymbol tests and some missing symbol kinds
Trzyipolkostkicukru May 4, 2019
9e1e493
Set syntactic_only to avoid unnecessary work, and mangle the name
Trzyipolkostkicukru May 4, 2019
f0391f6
refactor symbolKind(sourcekitSymbolKind:) to sourcekitd_uid_t extension
Trzyipolkostkicukru May 4, 2019
a519e5a
Mark Document Symbols as supported feature in README
Trzyipolkostkicukru May 4, 2019
ab76e92
Use SPM UserToolchain. Use proper toolchain to compile and manifest l…
krzyzanowskim May 7, 2019
bf1b2f3
Use manifest cache for faster startup
krzyzanowskim May 9, 2019
0c1a342
Merge pull request #104 from krzyzanowskim/marcin/usertoolchain
benlangmuir May 14, 2019
2aca722
[vscode] Update dependency on vscode module
benlangmuir May 29, 2019
d571212
Merge pull request #106 from benlangmuir/update-vscode-npm
benlangmuir May 29, 2019
26bb4b7
Update README.md
benlangmuir May 29, 2019
125cf2d
Update the linux tests
Trzyipolkostkicukru May 29, 2019
36e5673
Merge pull request #98 from Trzyipolkostkicukru/cukr/document-symbol
benlangmuir May 30, 2019
f499fb9
Merge pull request #94 from satishbabariya/master
benlangmuir May 30, 2019
9f9cc9a
Implement color presentation
Trzyipolkostkicukru May 29, 2019
41bbdfa
Update the linux tests
Trzyipolkostkicukru May 30, 2019
8782fbc
Add extra `-Xcxx` to docs, otherwise doesn't run command
jameshartt May 31, 2019
0c39f6a
Merge pull request #108 from jameshartt/master
benlangmuir May 31, 2019
fb2d4d1
Embrace Swift.Result in place SwiftPM.Basic.Result
krzyzanowskim Jun 10, 2019
a304c54
Merge pull request #109 from krzyzanowskim/marcin/swift-result
benlangmuir Jun 10, 2019
ba11bd9
Fix formatting
Trzyipolkostkicukru Jun 16, 2019
c5264a6
Refactor tests helper functions to fully perform requests
Trzyipolkostkicukru Jun 17, 2019
20662cd
Merge pull request #107 from Trzyipolkostkicukru/color-literal
benlangmuir Jun 19, 2019
5406e86
Add codeActions API
rockbruno Jan 19, 2019
0a248b6
Rework the Command architecture
rockbruno Feb 22, 2019
b8dbebc
Rework the Command architecture (2)
rockbruno Mar 3, 2019
69b6663
Add CodeActions/Command (Rework)
rockbruno Jun 15, 2019
7a97393
Make CommandArguments an enum
rockbruno Jun 17, 2019
24119a3
Remove CodeAction @escaping compiler workaround
rockbruno Jun 19, 2019
a60c50d
Make CodeAction wrapper types an enum
rockbruno Jun 19, 2019
0d15fdf
Add markdown escaping for names in hover request
Trzyipolkostkicukru Jun 25, 2019
5329b47
Tone down on what is escaped to prevent Sublime Text from showing wro…
Trzyipolkostkicukru Jun 25, 2019
73c69a7
Merge pull request #111 from Trzyipolkostkicukru/markdown-escaping
benlangmuir Jun 27, 2019
8482476
Merge pull request #72 from rockbruno/code-actions-api
benlangmuir Jun 27, 2019
587cd89
Support clients without completion snippets
rockbruno Jun 29, 2019
7d066d0
Omit completion displayNames when there's no snippet support
rockbruno Jul 1, 2019
cc76d2e
Merge pull request #115 from rockbruno/completion-snippets
benlangmuir Jul 5, 2019
7d201f3
Add EditorPlaceholder parsing
rockbruno Jun 29, 2019
40c57c8
Bump swift-tools-version to 5.1
benlangmuir Jul 8, 2019
1aac261
Merge pull request #119 from benlangmuir/bump-stv
benlangmuir Jul 9, 2019
475b22e
[readme] Clarify toolchain requirements for building
benlangmuir Jul 10, 2019
a959793
Fix table syntax
benlangmuir Jul 10, 2019
2de9c63
Merge pull request #120 from benlangmuir/clarify-tool
benlangmuir Jul 10, 2019
105b2fc
Add test for implicit typed editor placeholder
rockbruno Jul 12, 2019
75ad199
Add public initializers to Client capabilities structs.
krzyzanowskim Jul 15, 2019
762c62c
Add missing property
krzyzanowskim Jul 15, 2019
6894d79
Convert Language enum to struct
krzyzanowskim Jul 15, 2019
1d70250
Merge pull request #121 from krzyzanowskim/public-structs
benlangmuir Jul 15, 2019
21d3f13
Remove redundant ~=
krzyzanowskim Jul 15, 2019
2b7065a
Add Language.unknown for tests purposes
krzyzanowskim Jul 15, 2019
4376582
Remove language decoding check - no longer relevant
krzyzanowskim Jul 16, 2019
ea6d01d
Remove unused Language.unknown from tests
krzyzanowskim Jul 16, 2019
7de8dd0
Merge pull request #117 from rockbruno/completion-placeholder-parsing
benlangmuir Jul 19, 2019
223d11d
Add workspace/symbols support
literalpie Jul 20, 2019
e3e6bc6
[build-script] Accept --ninja-bin
benlangmuir Jul 22, 2019
91a4532
Merge pull request #124 from benlangmuir/ninja-sk-isdb-build-script
benlangmuir Jul 22, 2019
3044f73
Add infrastructure for test projects using Tibs
benlangmuir Jul 9, 2019
7667608
Implement "textDocument/implementation" request
Trzyipolkostkicukru Jul 24, 2019
810eb2b
FoundationXML: Adoption
millenomi Jul 31, 2019
9bc43b7
Merge pull request #127 from millenomi/foundationxml
akyrtzi Aug 1, 2019
edd0cf9
Merge pull request #125 from benlangmuir/test-infrastructure
benlangmuir Aug 1, 2019
806e8ef
Update for latest indexstore-db API
benlangmuir Aug 1, 2019
17ffd0a
Update status of Workspace Symbols in README
benlangmuir Aug 1, 2019
b8e79cc
Merge pull request #123 from literalpie/workspace-symbols
benlangmuir Aug 1, 2019
c614c70
Update FallbackBuildSystemTests for removal of Language.unknown
benlangmuir Aug 1, 2019
c48cb82
Merge pull request #122 from krzyzanowskim/language-struct
benlangmuir Aug 2, 2019
9b7065d
[build-script-helper] Add a search path to be able to find `Block.h` …
akyrtzi Aug 4, 2019
9591fde
Merge pull request #130 from akyrtzi/build-script-block
akyrtzi Aug 4, 2019
9e84e08
[docs] Add documentation about writing tests
benlangmuir Aug 6, 2019
131db61
[docs] Move debugging docs into new Development.md
benlangmuir Aug 6, 2019
b9025ab
[docs] Fix directory name casing
benlangmuir Aug 6, 2019
4dcc4e7
Merge pull request #131 from benlangmuir/docs1
benlangmuir Aug 6, 2019
7b61973
Merge remote-tracking branch 'upstream/master' into implementation
Trzyipolkostkicukru Aug 7, 2019
ef7d8ab
Add tests
Trzyipolkostkicukru Aug 7, 2019
3c04356
[swiftpm] Handle symlinks in the workspace path
benlangmuir Aug 7, 2019
7bfde0f
Merge pull request #132 from benlangmuir/boo-symlinks
benlangmuir Aug 8, 2019
57e3404
[clangd] Set correct argv[0] for clangd to fix c++ header search
benlangmuir Aug 8, 2019
a8472ad
Merge pull request #133 from benlangmuir/clang-argv0
benlangmuir Aug 8, 2019
e6adeb0
[test] Add a test for SwiftPM integration
benlangmuir Aug 8, 2019
2e98e6a
[test] Regenerate linuxmain
benlangmuir Aug 8, 2019
89fdb9d
[test] Use the improved location support for a range
benlangmuir Aug 8, 2019
d78c243
Merge pull request #134 from benlangmuir/swiftpm-test
benlangmuir Aug 8, 2019
578d8ac
Merge pull request #135 from benlangmuir/range-up
benlangmuir Aug 8, 2019
719bed2
Response to code review
Trzyipolkostkicukru Aug 8, 2019
c0d2ad0
Merge pull request #126 from Trzyipolkostkicukru/implementation
benlangmuir Aug 9, 2019
b61d974
[test] Update for TestLocation utf8/16 change
benlangmuir Aug 8, 2019
c9e18c1
[test] Update implementations test for TestLocation unicode
benlangmuir Aug 9, 2019
50bb56c
Merge pull request #136 from benlangmuir/testloc-unicode
benlangmuir Aug 9, 2019
b92abf4
Remove testable imports of SKCore
benlangmuir Aug 9, 2019
0e3625a
Remove tesable imports of SKSupport
benlangmuir Aug 9, 2019
64511cd
[sksupport] Refactor global log functions to be more testable
benlangmuir Aug 9, 2019
b3a89f9
Remove testable imports of LanguageServerProtocol
benlangmuir Aug 9, 2019
119b3fa
Rename Message -> JSONRPCMessage in preparation for making it public
benlangmuir Aug 9, 2019
ddd096f
Rename JSONRPCMessageHeader and methods in preparation for making public
benlangmuir Aug 9, 2019
65b98b3
Remove testable imports of LanguageServerProtocolJSONRPC
benlangmuir Aug 9, 2019
aa6087a
Remove testable imports of SourceKit
benlangmuir Aug 9, 2019
0857bd5
Remove -enable-testing from build-script-helper
benlangmuir Aug 9, 2019
f32f96b
make project.json spec-compliant by removing a trailing comma
Trzyipolkostkicukru Aug 9, 2019
11dad82
Merge pull request #137 from benlangmuir/remove-testable-imports
benlangmuir Aug 9, 2019
c868ec6
Merge pull request #138 from Trzyipolkostkicukru/fix-json
benlangmuir Aug 9, 2019
0e03291
[core] Support searching for xctoolcahin from within
benlangmuir Aug 9, 2019
a021f1b
[core] Teach ToolchainRegistry to search install path
benlangmuir Aug 9, 2019
194f793
[sourcekit-lsp] Prefer containing toolchain if applicable
benlangmuir Aug 9, 2019
a74933f
[swiftpm] Fix the bin path we pass to hostDestination
benlangmuir Aug 9, 2019
d82d0d0
Merge pull request #139 from benlangmuir/find-your-inner-toolchain
benlangmuir Aug 10, 2019
6c1f944
[test] Regenerate linuxmain
benlangmuir Aug 10, 2019
9c4145e
Merge pull request #140 from benlangmuir/linuxmain
benlangmuir Aug 10, 2019
916e5c6
Fix env variable warning
benlangmuir Aug 10, 2019
0a23148
Fix Linux warning about deprecated Process API
benlangmuir Aug 10, 2019
697d02a
Merge pull request #141 from benlangmuir/unwarn
benlangmuir Aug 10, 2019
7e2d7ba
[build-script] Add installation support for sourcekit-lsp
benlangmuir Aug 10, 2019
fe7f6cf
[build-script] Fix build directory calculation when using -v
benlangmuir Aug 12, 2019
9e8e088
[build-script] Add a flag to use normal swiftpm dependencies
benlangmuir Aug 12, 2019
5c8ed58
Merge pull request #142 from benlangmuir/install
benlangmuir Aug 12, 2019
f6045fc
remove toolchain from FileBuildSettings
Aug 15, 2019
1f57193
add toolchain interface to BuildServer
Aug 15, 2019
ace68d3
fix ws
Aug 15, 2019
22eeb4f
Merge pull request #143 from rmaz/separatetoolchain
benlangmuir Aug 15, 2019
940c447
Merge remote-tracking branch 'origin/master' into swift-5.1-branch
benlangmuir Aug 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions Documentation/Development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Development

This document contains notes about development and testing of SourceKit-LSP.

## Table of Contents

* [Debugging](#debugging)
* [Writing Tests](#writing-tests)

## Debugging

You can attach LLDB to SourceKit-LSP and set breakpoints to debug. You may want to instruct LLDB to wait for the sourcekit-lsp process to launch and then start your editor, which will typically launch
SourceKit-LSP as soon as you open a Swift file:

```sh
$ lldb -w -n sourcekit-lsp
```

If you are using the Xcode project, go to Debug, Attach to Process by PID or Name.

### Print SourceKit Logs

You can configure SourceKit-LSP to print log information from SourceKit to stderr by setting the following environment variable:

```sh
SOURCEKIT_LOGGING="N"
```

Where "N" configures the log verbosity and is one of the following numbers: 0 (error), 1 (warning), 2 (info), or 3 (debug).

## Writing Tests

As much as is practical, all code should be covered by tests. New tests can be added under the `Tests` directory and should use `XCTest`. The rest of this section will describe the additional tools available in the `SKTestSupport` module to make it easier to write good and efficient tests.

### Test Projects (Fixtures)

SourceKit test projects should be put in the `Tests/INPUTS` directory. Generally, they should use the [Tibs](#tibs) build system to define their sources and targets. An exception is for tests that need to specifically test the interaction with the Swift Package Manager. An example Tibs test project might look like:

```
Tests/
INPUTS/
MyTestProj/
a.swift
b.swift
c.cpp
```

Where `project.json` describes the project's targets, for example

```
{ "sources": ["a.swift", "b.swift", "c.cpp"] }
```

Tibs supports more advanced project configurations, such as multiple swift modules with dependencies, etc. For much more information about Tibs, including what features it supports and how it works, see [Tibs](#tibs).

### SKTibsTestWorkspace

The `SKTibsTestWorkspace` pulls together the various pieces needed for working with tests, including opening a connection to the language server, building the project to produce index data, loading source code into open documents, etc.

To create a `SKTibsTestWorkspace`, use the `staticSourceKitTibsWorkspace` method (the intent is to provide a `mutableSourceKitTibsWorkspace` method in the future for tests that mutate source code).

```swift
func testFoo() {
// Create the workspace, including opening a connection to the TestServer.
guard let ws = try staticSourceKitTibsWorkspace(name: "MyTestProj") else { return }
let loc = ws.testLoc("myLocation")

// Build the project and populate the index.
try ws.buildAndIndex()

// Open a document from the test project sources.
try ws.openDocument(loc.url, language: .swift)

// Send requests to the server.
let response = try ws.sk.sendSync(...)
}
```

#### Source Locations

It is common to want to refer to specific locations in the source code of a test project. This is supported using inline comment syntax.

```swift
Test.swift:
func /*myFuncDef*/myFunc() {
/*myFuncCall*/myFunc()
}
```

In a test, these locations can be referenced by name. The named location is immediately after the comment.

```swift

let loc = ws.testLoc("myFuncDef")
// TestLocation(url: ..., line: 1, column: 19)
```

`TestLocation`s can be easily converted to LSP `Location` and `Position`s.

```swift
Location(ws.testLoc("aaa:call"))
Position(ws.testLoc("aaa:call"))
```

## Tibs

We use Tibs, the "Test Index Build System" from the IndexStoreDB project to provide build system support for test projects, including getting compiler arguments and building an index.
For much more information about Tibs, see [IndexStoreDB/Documentation/Tibs.md](https://github.com/apple/indexstore-db/blob/master/Documentation/Tibs.md).
23 changes: 23 additions & 0 deletions Editors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@ autocmd FileType swift setlocal omnifunc=lsp#complete

With this added in `.vimrc`, you can use `<c-x><c-o>` in insert mode to trigger sourcekit-lsp completion.

## Theia Cloud IDE

You can use SourceKit-LSP with Theia by using the `theiaide/theia-swift` image. To use the image you need to have [Docker](https://docs.docker.com/get-started/) installed first.

The following command pulls the image and runs Theia IDE on http://localhost:3000 with the current directory as a workspace.

docker run -it -p 3000:3000 -v "$(pwd):/home/project:cached" theiaide/theia-swift:next

You can pass additional arguments to Theia after the image name, for example to enable debugging:

docker run -it -p 3000:3000 --expose 9229 -p 9229:9229 -v "$(pwd):/home/project:cached" theiaide/theia-swift:next --inspect=0.0.0.0:9229

Image Variants

`theiaide/theia-swift:latest`
This image is based on the latest stable released version.

`theiaide/theia-swift:next`
This image is based on the nightly published version.

theia-swift-docker source [theia-apps](https://github.com/theia-ide/theia-apps)


## Other Editors

SourceKit-LSP should work with any editor that supports the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
Expand Down
Loading