Coder Social home page Coder Social logo

rlovelett / langserver-swift Goto Github PK

View Code? Open in Web Editor NEW
176.0 10.0 16.0 263 KB

A Swift implementation of the open Language Server Protocol.

License: Apache License 2.0

Swift 98.48% Makefile 1.52%
swift-language language-server sourcekit vscode-extension vscode sourcekitten language-server-protocol swift macos swift-package-manager

langserver-swift's People

Contributors

chrismwendt avatar liquidsoul avatar rlovelett avatar vknabel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

langserver-swift's Issues

noManifest error on Sierra with VSCode.

I can compile both debug and release binaries fine, I copy the LanguageServer binary to /usr/local/bin and open a project within VSCode, but I get the following error:

fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/rob/Projects/ios-quizzer", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.48/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x0000000103fa9160 swift_reportError + 129
1    libswiftCore.dylib                 0x0000000103fc5a70 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x0000000103db6350 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x0000000103f6d390 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x0000000103db5a00 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x0000000103f6f8b0 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x0000000103db5f10 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x0000000103f30f70 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x0000000103db5a00 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x0000000103ee6c30 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x0000000103dde8d0 swift_unexpectedError_merged + 289
11   LanguageServer                     0x0000000103b54050 specialized Server.init(inDirectory : AbsolutePath) -> Server + 3101
12   LanguageServer                     0x0000000103b4a120 Server.__allocating_init(InitializeParams) -> Server? + 155
13   LanguageServer                     0x0000000103889200 specialized handle(Request) -> Response + 5625
14   LanguageServer                     0x00000001038876e0 (closure #1) + 751
15   LanguageServer                     0x0000000103888190 thunk + 66
16   Foundation                         0x00007fff9814ab5e -[__NSObserver _doit:] + 304
17   CoreFoundation                     0x00007fff96721500 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
18   CoreFoundation                     0x00007fff96721260 _CFXRegistrationPost + 427
19   CoreFoundation                     0x00007fff96721140 ___CFXNotificationPost_block_invoke + 50
20   CoreFoundation                     0x00007fff966dde80 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
21   CoreFoundation                     0x00007fff966dd380 _CFXNotificationPost + 604
22   Foundation                         0x00007fff98101955 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
23   Foundation                         0x00007fff981bea3c _performFileHandleSource + 1144
24   CoreFoundation                     0x00007fff9672b3b0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25   CoreFoundation                     0x00007fff9670c0a0 __CFRunLoopDoSources0 + 557
26   CoreFoundation                     0x00007fff9670b420 __CFRunLoopRun + 934
27   CoreFoundation                     0x00007fff9670b020 CFRunLoopRunSpecific + 420
28   Foundation                         0x00007fff9811d45d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
29   Foundation                         0x00007fff9811d3fe -[NSRunLoop(NSRunLoop) run] + 76
30   LanguageServer                     0x00000001038873f0 main + 723
31   libdyld.dylib                      0x00007fffabe6e234 start + 1

This happens on all of my projects (all were created in xcode). Any help would be appreciated! Thanks :)

swiftLanguageVersions contains non int element

When opening the Argo repository I am getting the following error.

Fatal error: swiftLanguageVersions contains non int element: file /home/rlovelett/Source/langserver-swift/.build/checkouts/swift-package-manager.git--2409619289911516842/Sources/PackageLoading/PackageDescription4Loader.swift, line 72
Current stack trace:
0    libswiftCore.so                    0x00007f7d3c58567d <unavailable> + 5518973
1    libswiftCore.so                    0x00007f7d3c5855e0 swift_reportError + 27
2    libswiftCore.so                    0x00007f7d3c65e5f0 _swift_stdlib_reportFatalErrorInFile + 191
3    libswiftCore.so                    0x00007f7d3c1c4d0d <unavailable> + 1584397
4    libswiftCore.so                    0x00007f7d3c56db32 <unavailable> + 5421874
5    libswiftCore.so                    0x00007f7d3c1c368c <unavailable> + 1578636
6    libswiftCore.so                    0x00007f7d3c56db71 <unavailable> + 5421937
7    libswiftCore.so                    0x00007f7d3c1c36a0 StaticString.withUTF8Buffer<A>(_:) + 1122
8    libswiftCore.so                    0x00007f7d3c1c4675 <unavailable> + 1582709
9    libswiftCore.so                    0x00007f7d3c56da7d <unavailable> + 5421693
10   libswiftCore.so                    0x00007f7d3c1c4d36 <unavailable> + 1584438
11   libswiftCore.so                    0x00007f7d3c56dace <unavailable> + 5421774
12   libswiftCore.so                    0x00007f7d3c1c4d80 String._withUnsafeBufferPointerToUTF8<A>(_:) + 335
13   libswiftCore.so                    0x00007f7d3c1c4491 <unavailable> + 1582225
14   libswiftCore.so                    0x00007f7d3c4bf5ba <unavailable> + 4707770
15   libswiftCore.so                    0x00007f7d3c1c368c <unavailable> + 1578636
16   libswiftCore.so                    0x00007f7d3c4bf601 <unavailable> + 4707841
17   libswiftCore.so                    0x00007f7d3c1c36a0 StaticString.withUTF8Buffer<A>(_:) + 1122
18   libswiftCore.so                    0x00007f7d3c1c1500 _assertionFailure(_:_:file:line:flags:) + 434
19   libSwiftPM.so                      0x00007f7d3b542803 <unavailable> + 2660355
20   libSwiftPM.so                      0x00007f7d3b54284c <unavailable> + 2660428
21   libSwiftPM.so                      0x00007f7d3b544a6b <unavailable> + 2669163
22   libswiftCore.so                    0x00007f7d3c1857e0 Collection.map<A>(_:) + 1972
23   libSwiftPM.so                      0x00007f7d3b53d726 <unavailable> + 2639654
24   libSwiftPM.so                      0x00007f7d3b53c060 loadPackageDescription4(_:baseURL:) + 134
25   libSwiftPM.so                      0x00007f7d3b50b0d0 ManifestLoader.loadFile(path:baseURL:version:manifestVersion:fileSystem:) + 3109
26   libSwiftPM.so                      0x00007f7d3b50ada0 ManifestLoader.load(packagePath:baseURL:version:manifestVersion:fileSystem:) + 589
27   libSwiftPM.so                      0x00007f7d3b50ef08 <unavailable> + 2449160
28   libSwiftPM.so                      0x00007f7d3b50a990 ManifestLoaderProtocol.load(package:baseURL:version:manifestVersion:fileSystem:) + 140
29   libSwiftPM.so                      0x00007f7d3b62d44e <unavailable> + 3621966
30   libSwiftPM.so                      0x00007f7d3b63c11e <unavailable> + 3682590
31   libSwiftPM.so                      0x00007f7d3b62d6fa <unavailable> + 3622650
32   libSwiftPM.so                      0x00007f7d3b63c16b <unavailable> + 3682667
33   libSwiftPM.so                      0x00007f7d3b5b06c0 DiagnosticsEngine.wrap<A>(with:_:) + 105
34   libSwiftPM.so                      0x00007f7d3b629654 <unavailable> + 3606100
35   libSwiftPM.so                      0x00007f7d3b6293d7 <unavailable> + 3605463
36   libSwiftPM.so                      0x00007f7d3b638701 <unavailable> + 3667713
37   libSwiftPM.so                      0x00007f7d3b6296d7 <unavailable> + 3606231
38   libSwiftPM.so                      0x00007f7d3b63874b <unavailable> + 3667787
39   libswiftCore.so                    0x00007f7d3c395890 Sequence._compactMap<A>(_:) + 911
40   libswiftCore.so                    0x00007f7d3c395790 Sequence.compactMap<A>(_:) + 145
41   libSwiftPM.so                      0x00007f7d3b625680 Workspace.loadRootManifests(packages:diagnostics:) + 348
42   libSwiftPM.so                      0x00007f7d3b622313 <unavailable> + 3576595
43   libSwiftPM.so                      0x00007f7d3b6283f0 Workspace.loadPackageGraph(root:createMultipleTestProducts:diagnostics:) + 200
44   (null)                             0x000056547302b7b9 <unavailable> + 878521
45   (null)                             0x000056547302ab6f <unavailable> + 875375
46   (null)                             0x000056547302a96c <unavailable> + 874860
47   (null)                             0x0000565472ffec24 <unavailable> + 695332
48   (null)                             0x00005654730027be <unavailable> + 710590
49   libdispatch.so                     0x00007f7d3d55455e <unavailable> + 263518
50   libdispatch.so                     0x00007f7d3d563877 <unavailable> + 325751
51   libdispatch.so                     0x00007f7d3d5545f4 <unavailable> + 263668
52   libdispatch.so                     0x00007f7d3d57f805 <unavailable> + 440325
53   libdispatch.so                     0x00007f7d3d573e69 <unavailable> + 392809
54   libdispatch.so                     0x00007f7d3d573ec7 <unavailable> + 392903
55   libdispatch.so                     0x00007f7d3d590a1a <unavailable> + 510490
56   libdispatch.so                     0x00007f7d3d592091 <unavailable> + 516241
57   libdispatch.so                     0x00007f7d3d594957 <unavailable> + 526679
58   libdispatch.so                     0x00007f7d3d593d06 <unavailable> + 523526
59   libdispatch.so                     0x00007f7d3d59078c <unavailable> + 509836
60   libdispatch.so                     0x00007f7d3d592091 <unavailable> + 516241
61   libdispatch.so                     0x00007f7d3d594957 <unavailable> + 526679
62   libdispatch.so                     0x00007f7d3d593d06 <unavailable> + 523526
63   libdispatch.so                     0x00007f7d3d59078c <unavailable> + 509836
64   libdispatch.so                     0x00007f7d3d59aeed <unavailable> + 552685
65   libdispatch.so                     0x00007f7d3d59a98c <unavailable> + 551308
66   libpthread.so.0                    0x00007f7d3be2a594 <unavailable> + 30100
67   libc.so.6                          0x00007f7d3a6b5fd0 clone + 63
[Info  - 9:07:46 AM] Connection to server got closed. Server will restart.

Crashes if no SwiftPM manifest

I've tried to open in a dir a VS Code with no SwiftPM manifest and it crashed:

fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/vhbit/tmp/Sourcery-0.6.0"
...
11   LanguageServer                     0x000000010958d550 specialized Server.init(inDirectory : AbsolutePath) -> Server + 3101
...

I wonder if it's possible to somehow specify "project" or at least display a problem and continue without advanced features as after 5 crashes in the row VS Code stops launching language server at all.

version: 0.2.0

Autocomplete for dependencies

Hi, first of all, really great work with this plugin!.

I have been playing a bit around with it, but i start to get some problems with no Autocomplete for SPM dependencies.
In my case, i am using the Vapor framework.

When i try to do something like:

import Vapor

public func routes(_ router: Router) throws {
    router.get("hello") { req -> String in 
        return "Hey!"
    }
}

I can with this PR #53 CMD+Click "get" to go into the module.

However if i try to add:

router.po

I get nothing (It should show router.post

Are there anything i am missing, or is it a problem in the system?, it could be nice to get this to work, as this+vscode would be a really strong alternative to Xcode :)

Implement textDocument/definition request and response for the language server

The textDocument/definition request is used to resolve the definition location of a symbol at a given text document position.

The language-server will be sent a request method of textDocument/definition and a params object that is conforms to TextDocumentPositionParams. The server should respond with a Location or [Location].

Xcode

I logged the commands run by Xcode to perform the same action here:
textdocument-definition.txt.

Plan

  1. Run source.request.indexsource on every source file in the workspace. Keep as "the index".
  2. Run source.request.cursorinfo to get the USR of string of the code entity at the location.
  3. Search "the index" for the USR where the key.kind is something like source.lang.swift.decl.*

Allow Configuration of Path to Swift Compiler for SwiftPM

Currently there is a method findBinDirectory in Server.swift that attempts to find the path the Swift compiler.

This compiler path is used by SwiftPM to interact with the Package.swift. Currently, if this path is not found or incorrect it causes a fatalError and hard crash of the language server.

I'd like to do (at least) two things before calling this issue done.

  • Allow the path to be configured/set by the user and directly passed in initializationOptions as part of InitializeParams.

  • If for some reason, the path is invalid or the compiler cannot be found, send an error to the client notifying the user that the path is invalid. Rather than crash.

  • This one is a stretch goal. Modify library_wrapper.swift to make use of this path instead of the existing logic in place.

Linux version

Great idea ๐Ÿ‘ ๐Ÿ˜
I'm looking forward to the Linux version ๐Ÿ˜‰

Compiling crashes the compiler for me :(

I wonder how you get this to compile. The Regex Module crashes the 12/1/2016 and 12/9/2016 version of the compiler on me. It works with 3.0.2 but this does not work with the langserver. What is the trick to get it running?

Compile Swift Module 'Regex' (8 sources)
Assertion failed: (hasAccessibility() && "accessibility not computed yet"), function getFormalAccess, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/include/swift/AST/Decl.h, line 2019.
0  swift                    0x00000001096c7066 llvm::sys::RunSignalHandlers() + 86
1  swift                    0x00000001096c8719 SignalHandler(int) + 361
2  libsystem_platform.dylib 0x00007fffc770abba _sigtramp + 26
> swift -v
Apple Swift version 3.0-dev (LLVM eb108553a5, Clang 94b9e5191c, Swift df7ad7cb12)
Target: x86_64-apple-macosx10.9
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-12-09-a.xctoolchain/usr/bin/lldb "--repl=-target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics"

LanguageServer always crashes on start.

fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/nojvek/git/Swiftris", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x00000001027b2130 swift_reportError + 129
1    libswiftCore.dylib                 0x00000001027cea40 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x00000001025bfba0 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x0000000102776360 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x00000001025bf250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x0000000102778880 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x00000001025bf760 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x0000000102739f40 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x00000001025bf250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x00000001026f0130 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x00000001025e8130 swift_unexpectedError_merged + 289
11   LanguageServer                     0x00000001020df250 Server.init(inDirectory : AbsolutePath) -> Server + 4615
12   LanguageServer                     0x00000001020ded90 Server.init(InitializeParams) -> Server? + 581
13   LanguageServer                     0x00000001020df140 Server.__allocating_init(InitializeParams) -> Server? + 46
14   LanguageServer                     0x0000000101d1a3c0 handle(Request) -> Response + 1221
15   LanguageServer                     0x0000000101d184e0 (closure #1) + 1070
16   LanguageServer                     0x0000000101d19300 thunk + 73
17   Foundation                         0x00007fffa2a22ace -[__NSObserver _doit:] + 304
18   CoreFoundation                     0x00007fffa0ff8450 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
19   CoreFoundation                     0x00007fffa0ff81b0 _CFXRegistrationPost + 427
20   CoreFoundation                     0x00007fffa0ff8090 ___CFXNotificationPost_block_invoke + 50
21   CoreFoundation                     0x00007fffa0fb4e00 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
22   CoreFoundation                     0x00007fffa0fb4300 _CFXNotificationPost + 604
23   Foundation                         0x00007fffa29d98c5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
24   Foundation                         0x00007fffa2a969ac _performFileHandleSource + 1144
25   CoreFoundation                     0x00007fffa1002310 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26   CoreFoundation                     0x00007fffa0fe2ff0 __CFRunLoopDoSources0 + 557
27   CoreFoundation                     0x00007fffa0fe2370 __CFRunLoopRun + 934
28   CoreFoundation                     0x00007fffa0fe1f70 CFRunLoopRunSpecific + 420
29   Foundation                         0x00007fffa29f53cd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
30   Foundation                         0x00007fffa29f536e -[NSRunLoop(NSRunLoop) run] + 76
31   LanguageServer                     0x0000000101d17f20 main + 915
32   libdyld.dylib                      0x00007fffb675c234 start + 1
[Info  - 2:09:33 PM] Connection to server got closed. Server will restart.
fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/nojvek/git/Swiftris", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x000000010b7a0130 swift_reportError + 129
1    libswiftCore.dylib                 0x000000010b7bca40 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x000000010b5adba0 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x000000010b764360 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x000000010b5ad250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x000000010b766880 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x000000010b5ad760 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x000000010b727f40 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x000000010b5ad250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x000000010b6de130 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x000000010b5d6130 swift_unexpectedError_merged + 289
11   LanguageServer                     0x000000010b0cf250 Server.init(inDirectory : AbsolutePath) -> Server + 4615
12   LanguageServer                     0x000000010b0ced90 Server.init(InitializeParams) -> Server? + 581
13   LanguageServer                     0x000000010b0cf140 Server.__allocating_init(InitializeParams) -> Server? + 46
14   LanguageServer                     0x000000010ad0a3c0 handle(Request) -> Response + 1221
15   LanguageServer                     0x000000010ad084e0 (closure #1) + 1070
16   LanguageServer                     0x000000010ad09300 thunk + 73
17   Foundation                         0x00007fffa2a22ace -[__NSObserver _doit:] + 304
18   CoreFoundation                     0x00007fffa0ff8450 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
19   CoreFoundation                     0x00007fffa0ff81b0 _CFXRegistrationPost + 427
20   CoreFoundation                     0x00007fffa0ff8090 ___CFXNotificationPost_block_invoke + 50
21   CoreFoundation                     0x00007fffa0fb4e00 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
22   CoreFoundation                     0x00007fffa0fb4300 _CFXNotificationPost + 604
23   Foundation                         0x00007fffa29d98c5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
24   Foundation                         0x00007fffa2a969ac _performFileHandleSource + 1144
25   CoreFoundation                     0x00007fffa1002310 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26   CoreFoundation                     0x00007fffa0fe2ff0 __CFRunLoopDoSources0 + 557
27   CoreFoundation                     0x00007fffa0fe2370 __CFRunLoopRun + 934
28   CoreFoundation                     0x00007fffa0fe1f70 CFRunLoopRunSpecific + 420
29   Foundation                         0x00007fffa29f53cd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
30   Foundation                         0x00007fffa29f536e -[NSRunLoop(NSRunLoop) run] + 76
31   LanguageServer                     0x000000010ad07f20 main + 915
32   libdyld.dylib                      0x00007fffb675c234 start + 1
[Info  - 2:09:33 PM] Connection to server got closed. Server will restart.
fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/nojvek/git/Swiftris", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x000000010397f130 swift_reportError + 129
1    libswiftCore.dylib                 0x000000010399ba40 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x000000010378cba0 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x0000000103943360 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x000000010378c250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x0000000103945880 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x000000010378c760 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x0000000103906f40 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x000000010378c250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x00000001038bd130 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x00000001037b5130 swift_unexpectedError_merged + 289
11   LanguageServer                     0x00000001032ac250 Server.init(inDirectory : AbsolutePath) -> Server + 4615
12   LanguageServer                     0x00000001032abd90 Server.init(InitializeParams) -> Server? + 581
13   LanguageServer                     0x00000001032ac140 Server.__allocating_init(InitializeParams) -> Server? + 46
14   LanguageServer                     0x0000000102ee73c0 handle(Request) -> Response + 1221
15   LanguageServer                     0x0000000102ee54e0 (closure #1) + 1070
16   LanguageServer                     0x0000000102ee6300 thunk + 73
17   Foundation                         0x00007fffa2a22ace -[__NSObserver _doit:] + 304
18   CoreFoundation                     0x00007fffa0ff8450 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
19   CoreFoundation                     0x00007fffa0ff81b0 _CFXRegistrationPost + 427
20   CoreFoundation                     0x00007fffa0ff8090 ___CFXNotificationPost_block_invoke + 50
21   CoreFoundation                     0x00007fffa0fb4e00 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
22   CoreFoundation                     0x00007fffa0fb4300 _CFXNotificationPost + 604
23   Foundation                         0x00007fffa29d98c5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
24   Foundation                         0x00007fffa2a969ac _performFileHandleSource + 1144
25   CoreFoundation                     0x00007fffa1002310 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26   CoreFoundation                     0x00007fffa0fe2ff0 __CFRunLoopDoSources0 + 557
27   CoreFoundation                     0x00007fffa0fe2370 __CFRunLoopRun + 934
28   CoreFoundation                     0x00007fffa0fe1f70 CFRunLoopRunSpecific + 420
29   Foundation                         0x00007fffa29f53cd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
30   Foundation                         0x00007fffa29f536e -[NSRunLoop(NSRunLoop) run] + 76
31   LanguageServer                     0x0000000102ee4f20 main + 915
32   libdyld.dylib                      0x00007fffb675c234 start + 1
[Info  - 2:09:33 PM] Connection to server got closed. Server will restart.
fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/nojvek/git/Swiftris", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x0000000106a46130 swift_reportError + 129
1    libswiftCore.dylib                 0x0000000106a62a40 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x0000000106853ba0 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x0000000106a0a360 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x0000000106853250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x0000000106a0c880 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x0000000106853760 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x00000001069cdf40 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x0000000106853250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x0000000106984130 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x000000010687c130 swift_unexpectedError_merged + 289
11   LanguageServer                     0x0000000106375250 Server.init(inDirectory : AbsolutePath) -> Server + 4615
12   LanguageServer                     0x0000000106374d90 Server.init(InitializeParams) -> Server? + 581
13   LanguageServer                     0x0000000106375140 Server.__allocating_init(InitializeParams) -> Server? + 46
14   LanguageServer                     0x0000000105fb03c0 handle(Request) -> Response + 1221
15   LanguageServer                     0x0000000105fae4e0 (closure #1) + 1070
16   LanguageServer                     0x0000000105faf300 thunk + 73
17   Foundation                         0x00007fffa2a22ace -[__NSObserver _doit:] + 304
18   CoreFoundation                     0x00007fffa0ff8450 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
19   CoreFoundation                     0x00007fffa0ff81b0 _CFXRegistrationPost + 427
20   CoreFoundation                     0x00007fffa0ff8090 ___CFXNotificationPost_block_invoke + 50
21   CoreFoundation                     0x00007fffa0fb4e00 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
22   CoreFoundation                     0x00007fffa0fb4300 _CFXNotificationPost + 604
23   Foundation                         0x00007fffa29d98c5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
24   Foundation                         0x00007fffa2a969ac _performFileHandleSource + 1144
25   CoreFoundation                     0x00007fffa1002310 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26   CoreFoundation                     0x00007fffa0fe2ff0 __CFRunLoopDoSources0 + 557
27   CoreFoundation                     0x00007fffa0fe2370 __CFRunLoopRun + 934
28   CoreFoundation                     0x00007fffa0fe1f70 CFRunLoopRunSpecific + 420
29   Foundation                         0x00007fffa29f53cd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
30   Foundation                         0x00007fffa29f536e -[NSRunLoop(NSRunLoop) run] + 76
31   LanguageServer                     0x0000000105fadf20 main + 915
32   libdyld.dylib                      0x00007fffb675c234 start + 1
[Info  - 2:09:33 PM] Connection to server got closed. Server will restart.
fatal error: 'try!' expression unexpectedly raised an error: PackageModel.Package.Error.noManifest(baseURL: "/Users/nojvek/git/Swiftris", version: nil): file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182
Current stack trace:
0    libswiftCore.dylib                 0x00000001012b8130 swift_reportError + 129
1    libswiftCore.dylib                 0x00000001012d4a40 _swift_stdlib_reportFatalErrorInFile + 100
2    libswiftCore.dylib                 0x00000001010c5ba0 (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 124
3    libswiftCore.dylib                 0x000000010127c360 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1).(closure #1) + 93
4    libswiftCore.dylib                 0x00000001010c5250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
5    libswiftCore.dylib                 0x000000010127e880 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1).(closure #1) + 144
6    libswiftCore.dylib                 0x00000001010c5760 specialized specialized String._withUnsafeBufferPointerToUTF8<A> ((UnsafeBufferPointer<UInt8>) throws -> A) throws -> A + 127
7    libswiftCore.dylib                 0x000000010123ff40 partial apply for (_assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never).(closure #1) + 185
8    libswiftCore.dylib                 0x00000001010c5250 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 342
9    libswiftCore.dylib                 0x00000001011f6130 specialized _assertionFailure(StaticString, String, file : StaticString, line : UInt, flags : UInt32) -> Never + 144
10   libswiftCore.dylib                 0x00000001010ee130 swift_unexpectedError_merged + 289
11   LanguageServer                     0x0000000100be1250 Server.init(inDirectory : AbsolutePath) -> Server + 4615
12   LanguageServer                     0x0000000100be0d90 Server.init(InitializeParams) -> Server? + 581
13   LanguageServer                     0x0000000100be1140 Server.__allocating_init(InitializeParams) -> Server? + 46
14   LanguageServer                     0x000000010081c3c0 handle(Request) -> Response + 1221
15   LanguageServer                     0x000000010081a4e0 (closure #1) + 1070
16   LanguageServer                     0x000000010081b300 thunk + 73
17   Foundation                         0x00007fffa2a22ace -[__NSObserver _doit:] + 304
18   CoreFoundation                     0x00007fffa0ff8450 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
19   CoreFoundation                     0x00007fffa0ff81b0 _CFXRegistrationPost + 427
20   CoreFoundation                     0x00007fffa0ff8090 ___CFXNotificationPost_block_invoke + 50
21   CoreFoundation                     0x00007fffa0fb4e00 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
22   CoreFoundation                     0x00007fffa0fb4300 _CFXNotificationPost + 604
23   Foundation                         0x00007fffa29d98c5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
24   Foundation                         0x00007fffa2a969ac _performFileHandleSource + 1144
25   CoreFoundation                     0x00007fffa1002310 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26   CoreFoundation                     0x00007fffa0fe2ff0 __CFRunLoopDoSources0 + 557
27   CoreFoundation                     0x00007fffa0fe2370 __CFRunLoopRun + 934
28   CoreFoundation                     0x00007fffa0fe1f70 CFRunLoopRunSpecific + 420
29   Foundation                         0x00007fffa29f53cd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
30   Foundation                         0x00007fffa29f536e -[NSRunLoop(NSRunLoop) run] + 76
31   LanguageServer                     0x0000000100819f20 main + 915
32   libdyld.dylib                      0x00007fffb675c234 start + 1
[Error - 2:09:33 PM] Connection to server got closed. Server will not be restarted.

Still not able to compile :(

I still can't compile (tried the new 3.0.2 release and the 12/8 Snapshot). This time for a reason I really don't get?

> swift build -c release -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
...
...
Compile Swift Module 'LanguageServerProtocol' (37 sources)
/Users/.../langserver-swift/Sources/LanguageServerProtocol/Extenstions/URL.swift:20:16: error: 'init(fileURLWithPath:isDirectory:relativeTo:)' is only available on OS X 10.11 or newer
...

sad face..

Ignore the Package.swift

When you open the Package.swift file in VS Code you get an error:

[Error - 9:47:15 PM] Request textDocument/hover failed.
  Message: Could not find /Users/ryan/Source/castable-server/Package.swift in the workspace.
  Code: -32099

This is because the file is not in the "project" as defined by the language server.

LanguageServer does not work for me in Visual Studio Code

(๐Ÿ‘ for you work btw!)

I got the LanguageServer and sourcekitten compiled and moved both to /usr/local/bin. Using Visual Studio Code and hover over "anything" I now get:

[Error - 8:35:43 PM] Request textDocument/hover failed.
  Message: There was an error communicating with SourceKit.
  Code: -32097 

I also get hovers which look like this:

image

Any Ideas?

Crude XML Tag removal...

Popup on all elements seem to work fine for me now!

Maybe just remove the XML Tags from the result by adding a simple filter which translates those tags into either "nothing", "a space" or "a newline". With using "a space" for all unknown tags.

If it is possible to output your own HTML in the popup you could also translate the XML tag into a prefixed css class and all of the tags into div (or span) elements. So one could adjust the output with CSS easily and adding newly encountered tag types would be fairly easy.

Implement workspace/symbol request and response for the language server

SourceKit

Request

{
  key.request: source.request.indexer.srv.symbol-contains,
  key.indexer.arg.indexer-token: 1,
  key.indexer.arg.symbol.name: "ar",
  key.indexer.arg.symbol.is-anchor-start: false,
  key.indexer.arg.symbol.is-anchor-end: false,
  key.indexer.arg.symbol.is-subsequence: false,
  key.indexer.arg.symbol.is-ignore-case: true
}

Response

{
  key.symbols: [
    {
      key.symbol: {
        key.indexer.arg.symbol.name: "Bar",
        key.indexer.arg.symbol.kind: "Xcode.SourceCodeSymbolKind.Swift.Struct",
        key.indexer.arg.symbol.language: "Xcode.SourceCodeLanguage.Swift",
        key.indexer.arg.symbol.resolution: "s:V4Test3Bar"
      },
      key.indexer.arg.occurrence.role: 2,
      key.indexer.arg.occurrence.location: {
        key.indexer.arg.doc-loc.url: "file:///Users/ryan/Desktop/Test/Sources/bar.swift",
        key.indexer.arg.doc-loc.start-line: 0,
        key.indexer.arg.doc-loc.start-col: 7,
        key.indexer.arg.doc-loc.end-line: 0,
        key.indexer.arg.doc-loc.end-col: 7,
        key.indexer.arg.doc-loc.range-loc: 9223372036854775807,
        key.indexer.arg.doc-loc.range-count: 0,
        key.indexer.arg.doc-loc.time-stamp: 4.994871e+08,
        key.indexer.arg.doc-loc.encoding: 0
      },
      key.indexer.arg.occurrence.line: 1,
      key.indexer.arg.occurrence.col: 8,
      key.indexer.arg.occurrence.file: "/Users/ryan/Desktop/Test/Sources/bar.swift",
      key.indexer.arg.symbol.display-name: "Bar",
      key.indexer.arg.symbol.qualified-display-name: "Bar",
      key.indexer.arg.symbol.is-in-project: true,
      key.indexer.arg.symbol.is-virtual: false,
      key.indexer.arg.symbol.is-system: false
    },
   ...
}

I've attached a log of Xcode performing the same operation using SourceKit.
workspace-symbol.txt

Cross-module definition doesn't work

2018-05-31 13 15 09

This happens because the framework path for the project is not getting passed to the swift compiler.

$ swift --help
...
  -F <value>              Add directory to framework search path
...

With -F, cursorinfo across modules works (I'm on bebf0d1):

cat <<EOF | sourcekitd-repl
{
  key.request: source.request.cursorinfo,
  key.compilerargs: [
    "-sdk",
    "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk",
    "-F",
    "/Users/chrismwendt/Library/Developer/Xcode/DerivedData/langserver-swift-decoewqzatmxuugoqscoirgsoekn/Build/Products/Debug",
    "/Users/chrismwendt/langserver-swift/Sources/LanguageServer/main.swift",
  ],
  key.offset: 368,
  key.sourcefile: "/Users/chrismwendt/langserver-swift/Sources/LanguageServer/main.swift",
}
EOF

And returns:

{
  key.kind: source.lang.swift.ref.class,
  key.name: "RequestBuffer",
  key.usr: "s:12BaseProtocol13RequestBufferC",
  key.typename: "RequestBuffer.Type",
  key.annotated_decl: "<Declaration>class RequestBuffer</Declaration>",
  key.fully_annotated_decl: "<decl.class><syntaxtype.keyword>class</syntaxtype.keyword> <decl.name>RequestBuffer</decl.name></decl.class>",
  key.typeusr: "_T012BaseProtocol13RequestBufferCmD",
  key.modulename: "BaseProtocol"
}

The correct path can be obtained by running this build command (similar to the one listed in the README:

$ xcodebuild -project langserver-swift.xcodeproj -scheme langserver-swift -showBuildSettings | grep "TARGET_BUILD_DIR"
   TARGET_BUILD_DIR = /Users/chrismwendt/Library/Developer/Xcode/DerivedData/langserver-swift-decoewqzatmxuugoqscoirgsoekn/Build/Products/Debug

The -scheme langserver-swift can be obtained with swift package dump-package | jq -r .name, but it's probably not safe to assume that there is a scheme with the same name as the package.

I'm thinking about running those commands and passing it to the compiler at https://github.com/chrismwendt/langserver-swift/blob/bebf0d10c51c8c0fa71d557b4fcf90fb92e64615/Sources/LanguageServerProtocol/Types/Server.swift#L179

@RLovelett Does this approach make sense?

Snippets Are Not Rendering Anymore

peek 2018-05-27 13-06

The GIF above exemplifies the issue. Notice when it injects the code Bar(x: {{1:Int}}, y: {{2: String}}) that VSCode is not treating the arguments as tab stops.

It used to do this. This might have regressed Adopt SnippetString API. Though as far as I can tell we do this already.

My best guess right now is that the LSP defines a property insertTextFormat which is of type InsertTextFormat. Currently this implementation of the LSP has no such property or type. I do not remember that being there when I originally implemented this.

Current CompletionItem Sent

Content-Type: application/vscode-jsonrpc; charset=utf8
Content-Length: 161

{"id":10,"result":[{"label":"(x: Int, y: String)","kind":4,"detail":"bar.Bar (x: Int, y: String)","insertText":"x: {{1:Int}}, y: {{2:String}}"}],"jsonrpc":"2.0"}

Build failure

~/s/langserver-swift (master|โœ“)
$ make debug
swift build -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
Updating https://github.com/thoughtbot/Argo.git
Updating https://github.com/RLovelett/SourceKit.git
Updating https://github.com/thoughtbot/Curry.git
Updating https://github.com/RLovelett/swift-package-manager.git
Updating https://github.com/edwardaux/Ogra.git
Updating https://github.com/thoughtbot/Runes.git
error: noManifest(baseURL: "https://github.com/thoughtbot/Argo.git", version: Optional("4.0.0"))
make: *** [debug] Error 1
Exit code: 2
$ swift --version
Apple Swift version 4.0 (swiftlang-900.0.59 clang-900.0.34.2)
Target: x86_64-apple-macosx10.9

enhancement - log tracking / reconn

I was reviewing the official golang project and some log tracking caught my eye.
You may consider cherry picking to catch bugs.

Go Language Server (Experimental)
screen shot 2017-05-15 at 21 19 51

To collect traces, set "go.languageServerFlags": ["-trace"]
To collect errors from language server in a logfile, set "go.languageServerFlags": ["-trace", "-logfile", "path to a text file that exists" ]

screen shot 2017-05-15 at 21 24 18

Pretty nice - it exposes the ability to execute methods of go code.

screen shot 2017-05-15 at 21 25 38

Swift 4 update

Hi @RLovelett ,

Your Swift extension for Visual Studio Code is awesome and I'm using it everyday with Xcode.
Do you plan to continue support and release update for Swift 4?

Thanks

swift build fails to compile

Mac OS 10.12

Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9
/Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics"
Welcome to Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1). Type :help for assistance.

 langserver-swift git:(master) swift build -Xswiftc -target -Xswiftc x86_64-apple-macosx10.12
Cloning https://github.com/RLovelett/SourceKit.git
HEAD is now at 5e48727 Get the header for `sourcekitd_variant_json_description_copy`
Resolved version: 1.0.2
Cloning https://github.com/thoughtbot/Argo.git
HEAD is now at 203daf8 Bump version: 4.1.2
Resolved version: 4.1.2
Cloning https://github.com/thoughtbot/Runes.git
HEAD is now at e1bb1f7 Bump version: 4.1
Resolved version: 4.1.0
Cloning https://github.com/edwardaux/Ogra.git
HEAD is now at b4f1802 Merge branch '4.1.2'
Resolved version: 4.1.2
Cloning https://github.com/thoughtbot/Curry.git
HEAD is now at c9f1a37 Update version to 3.0
Resolved version: 3.0.0
Cloning https://github.com/RLovelett/swift-package-manager.git
HEAD is now at c300728 More changes
Resolved version: 3.1.1-beta.1
Compile Swift Module 'PackageDescription' (6 sources)
Compile Swift Module 'swiftpm_xctest_helper' (1 sources)
Compile Swift Module 'libc' (2 sources)
Compile Swift Module 'Curry' (1 sources)
Compile Swift Module 'Runes' (9 sources)
Compile Swift Module 'Argo' (19 sources)
Compile Swift Module 'POSIX' (15 sources)
Linking ./.build/debug/libPackageDescription.dylib
Compile Swift Module 'Ogra' (1 sources)
Compile Swift Module 'Basic' (23 sources)
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter '

'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:93:34: error: same-type requirement makes generic parameter 'ErrorType' non-generic
extension Result where ErrorType == AnyError {
                                 ^
/Users/nojvek/git/langserver-swift/Packages/SwiftPM-3.1.1-beta.1/Sources/Basic/Result.swift:95:45: error: use of undeclared type 'Value'
    public init(anyError body: () throws -> Value) {
                                            ^~~~~
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/nojvek/git/langserver-swift/.build/debug.yaml

Cannot compile release

Running swift build -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11 -c release fails to compile on master.

I've reported this to bugs.swift.org as SR-4253. Unfortunately until either a fix or a work-around is found no release can currently be made.

Created an issue here to track it as well.

unexpectedly found nil while unwrapping an Optional value

Running the language server:

import Foundation
struct Foo {
  var i = 0
}
struct Bar {
  var k: Foo

  func test() {
      k.
       _^_
  }
}
fatal error: unexpectedly found nil while unwrapping an Optional value
Current stack trace:
0    libswiftCore.dylib                 0x000000010205cce0 swift_reportError + 132
1    libswiftCore.dylib                 0x000000010207a090 _swift_stdlib_reportFatalError + 61
2    libswiftCore.dylib                 0x0000000101e700c0 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 355
3    libswiftCore.dylib                 0x0000000101fec230 partial apply for (_fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never).(closure #2) + 109
4    libswiftCore.dylib                 0x0000000101e700c0 specialized specialized StaticString.withUTF8Buffer<A> ((UnsafeBufferPointer<UInt8>) -> A) -> A + 355
5    libswiftCore.dylib                 0x0000000101fa43f0 specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never + 96
6    LanguageServer                     0x0000000101873e70 handle(Request) -> Response + 2030
7    LanguageServer                     0x0000000101871950 (closure #1) + 2132
8    LanguageServer                     0x00000001018733f0 thunk + 73
9    Foundation                         0x00007fff82232bfe -[__NSObserver _doit:] + 304
10   CoreFoundation                     0x00007fff80806a60 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
11   CoreFoundation                     0x00007fff808067c0 _CFXRegistrationPost + 427
12   CoreFoundation                     0x00007fff808066a0 ___CFXNotificationPost_block_invoke + 50
13   CoreFoundation                     0x00007fff807c3640 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
14   CoreFoundation                     0x00007fff807c2b40 _CFXNotificationPost + 604
15   Foundation                         0x00007fff821e99f5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
16   Foundation                         0x00007fff822a6a7c _performFileHandleSource + 1144
17   CoreFoundation                     0x00007fff80810970 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18   CoreFoundation                     0x00007fff807f1850 __CFRunLoopDoSources0 + 557
19   CoreFoundation                     0x00007fff807f0bd0 __CFRunLoopRun + 934
20   CoreFoundation                     0x00007fff807f07d0 CFRunLoopRunSpecific + 420
21   Foundation                         0x00007fff822054fd -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
22   Foundation                         0x00007fff8220549e -[NSRunLoop(NSRunLoop) run] + 76
23   LanguageServer                     0x00000001018713d0 main + 1035
24   libdyld.dylib                      0x00007fff95d59254 start + 1
[Info  - 3:56:26 PM] Connection to server got closed. Server will restart.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.