Skip to content

SourceKit Language Server emits errors, autocomplete doesn't work #561

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

Closed
p-lenart opened this issue Jun 30, 2023 · 4 comments
Closed

SourceKit Language Server emits errors, autocomplete doesn't work #561

p-lenart opened this issue Jun 30, 2023 · 4 comments
Labels
bug Something isn't working windows Issue specific to Windows

Comments

@p-lenart
Copy link

Describe the bug
After fetching all dependencies, autocompletion doesn't work. Here are logs from the Output:

SourceKit Lanaguage Server:

D:\SwiftDemo\Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^
D:\SwiftDemo\Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^

Swift

12:31:47: SourceKit-LSP setup
12:31:47: compnerd.org Swift version 5.9-dev (LLVM 4a3b38183d7bb09, Swift 44a40979e52be8e)
12:31:48: SwiftDemo: add: d:\SwiftDemo
12:31:48: SwiftDemo: Resolving Dependencies ... done.
12:31:50: SwiftDemo: focus: d:\SwiftDemo
12:31:51: SwiftDemo: Test Discovery Failed: error: The operation could not be completed. The file doesn’t exist.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir SwiftDemo
  2. cd SwiftDemo
  3. swift package init --name SwiftDemo
  4. Open project in VSCode
  5. Add some code to test autocompletion
  6. Autocomplete functionality doesn't work

Expected behavior
Autocomplete support works as expected

Environment

  • OS: Windows 11
  • Swift version Swift version 5.9-dev (LLVM 4a3b38183d7bb09, Swift 44a40979e52be8e) (downloaded from here )
  • Visual Studio Code version: 1.79.2 695af097c7bd098fbf017ce3ac85e09bbc5dda06 x64
  • vscode-swift version: v1.3.0

Additional context
n/a

@p-lenart p-lenart added the bug Something isn't working label Jun 30, 2023
@adam-fowler
Copy link
Contributor

Autocompletion via Sourcekit-lsp only works after you have built the project

@p-lenart
Copy link
Author

p-lenart commented Jul 3, 2023

Autocompletion via Sourcekit-lsp only works after you have built the project

Does it matter if I run it from a "Run Build Task" or manually from the console?

I still have problems with autocomplete not working for a larger, private project, but I'm not sure how I can provide more information to track down an issue.

@adam-fowler
Copy link
Contributor

You can run build either inside VSCode or via the command line. The index is built when you compile using either of these methods.

I've found sometimes sourcekit-lsp still fails (never been able to narrow down the reasons for this). Running the restart LSP server command after this normally fixes the issue.

@adam-fowler
Copy link
Contributor

Closing as related SourceKit-LSP has been resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Issue specific to Windows
Projects
None yet
Development

No branches or pull requests

2 participants