-
Notifications
You must be signed in to change notification settings - Fork 72
[Windows] SourceKit-LSP does not provide IntelliSense for types outside of current file #479
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
Comments
Same here, I just installed latest Swift for Windows and the extension. |
I might be mistaken but I think that it did work a few versions back. Can not say for sure |
no this has never worked. i have reported this before and the issue was just closed after a while. |
Hope they will look into it if this issue gets more traction |
Source editing feature like jump to definition, symbol completion only work after you have built your project. There is also a bug with SourceKit-LSP. To get it to recognise the project has been rebuilt (the first time) you need to restart the LSP server. I have added an issue to the SourceKit-LSP repo swiftlang/sourcekit-lsp#620 for this. While this is still an issue I also added a |
I am aware of this. But this does not apply to windows. Rebuilding does not change anything. I did rebuild via the task, and terminal, issue persists. Restarting the LSP server does not help either. The feature just doesn't work on windows at all |
I've just seen it work on Windows. I double checked before posting my response. In the settings can you set the SourceKit-LSP tracing to verbose, restart vscode (or run |
Hmm that is weird. Restarting didn't help for me. I'll do what you said in a minute. Are you using the same toolchain ? |
I'm using |
@adam-fowler Still no luck.
|
Ok you got no response from the server which means it could have crashed, or we never found it. What happens if you type
and
|
C:\Users\Marcel>where swift C:\Users\Marcel>where sourcekit-lsp |
Typing sourcekit-lsp into the terminal does seem to run LSP. I do not get any output, but the task does not close, so something is happening |
Ok I've run out of ideas just now, I'm going to have to talk to few other people to see if they have a better idea what is going on here. |
No problem! I actually never got it to run, I tried a lot of stuff before. If you need additional info, just notify me here |
Do you have a |
Of course. |
How much system RAM do you have? I wonder if there is a configuration difference in the connection (it may be that the dispatch source is hanging). |
I honestly doubt that. I am on a really fast computer:
|
The only non-software issue I could possibly see would be me doing something wrong. But I am always doing this:
|
I have 16G on the machine that I test the LSP on and that runs fine. This is unlikely to be that the pipe is filled up then. Interesting, I've normally just opened the project and did a build internally with no restart and that would pick up the completion 🤔 . I wonder if we should step back and try to do this with a project that we all can replicate to find the divergence. Perhaps something like swift-driver would be a good starting point (SourceKit-LSP would be my first suggestion, but that cannot be built with SPM anymore due to SPM forcing and failing to do static linking). |
I'll have to check again but I think even new projects with just two files had the same result. |
Hmm, would you mind also trying the 5.8 snapshot? I don't have 5.7 installed anymore, I've been using 5.8. |
I'll download it and post my results |
Code completion doesn't work 100% all the time but it does seem to have improved. Was able to get some auto-completion for other file's types. What didn't work was auto-complete for types imported from another |
You can't really have it restart always as this would hide issues which are causing the LSP server to crash. I can up the number of retry attempts. I do have a PR that will allow you to restart the server from the dialog but it is reliant on a beta version of the vs code language client. Hopefully that'll be released in February. Were you seeing this dialog before with swift 5.7? |
The language server did crash for me on Windows every now and then. Probably at least twice per hour. Always had that issue |
It does happen quite a lot especially when you are working on generics and that stuff. |
In the current situation on Windows, where you aren't getting auto-completion etc are you getting the server crashed messsages all the time, ie is auto-completion not working because the server has crashed? |
No. I did. get the autocomplete to work on Swift 5.8. The crash is another issue |
Yes there are crashes, Swift 5.7 is notably less stable than Swift 5.6. I haven't looked into 5.8 much yet. If you do get one and can work out what test you typed that caused the crash please add them as issues to the SourceKit-LSP repo. |
Is this a dynamic C/C++ library or a Swift library? This sounds like it may be an include path issue. |
It was just a Swift library. It does import Swift Win32 though |
That might be the issue. I don't know if SourceKit-LSP picks up flags from the command line; you need to ensure that the include path is setup properly and processed by the LSP to ensure that it can process the module. |
The module does get detected, I also do get proper code-completion. Just when building it dynamically, I don't get code-completion when importing the target |
How are you importing the dynamically linked library? This is something which currently is not possible with SPM - SPM implicitly statically links (incorrectly) code that is built for dynamic linking. The system library infrastructure is not complete either, that is while it has the nuget provider, the import for that is not setup, so this makes me wonder how it is that you are configuring SPM to import the dynamic library and passing along that information to SourceKit-LSP. |
I just import it as a product as usual |
@broken-bytes could you give an example of that? |
@compnerd Sorry, I never saw the message here. I am working on the project right now, I changed some stuff but the issues remain. I can upload it to a public repo later. Another thing though: |
Any update on this issue? this bug renders the plugin essentially unusable on windows. |
I haven't had any chance to look at this any further. Personally I'm not seeing the issue. I'm guessing it is related to Swift install but not totally sure what it could be. |
could it be that your testing machine is tainted? bc i have never managed to get this plugin to work on any of my windows machines and windows installs. |
My testing machine gets updated every 3 months as it is a dev image from MS with a limited license (downloaded from https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/) which I run through Parallels. Once I have that setup I follow the install instructions on the swift.org site (with one minor change). The python install is
|
OK looks like I can reproduce this now. I can see commands being sent to the LSP server and it returning empty responses. I seem to be able to fix it by cleaning the build, and then compiling. If you don't reload the window or restart the LSP server it seems to work. As soon as you reload the window it stops working. This looks like an indexing issue, most likely something internal in the compiler or sourcekit-lsp. I'll investigate a little further see if I can find anything else that can help, but I doubt I'll be the one that resolves this. In the meantime I'll add a bug to the sourcekit-lsp repo. The other thing I have found out is |
@GideonUng can you verify if this works. I want to be sure we are seeing the same thing |
@adam-fowler yep i can confirm just that. without |
5.8 resolved this issue for me now :) |
I'll download 5.8 on Windows and test it later |
This is also working for me now. I cannot replicate the issues I was seeing three weeks ago. @broken-bytes if you could verify we can then close this. |
Closing as we have had no response. There are still known issue, but they are not vscode-swift issues. It looks like they might be issues with the Windows version of Foundation (used in source kit-lsp). See swiftlang/sourcekit-lsp#752 |
Describe the bug
IntelliSense does not seem to pick up types that are not in the same file. I do not get any auto-completion, nor proper error highlighting if the type I want to access is not part of the current file.
Update: Go to References etc. does not work either.
Building works just fine, so the issue must be with SourceKit-LSP.
To Reproduce
Expected behavior
The editor should automatically provide these features no matter in what file other types are.
Environment
Additional context
Tried with Swift 5.6, 5.7.1, and 5.7.2
The text was updated successfully, but these errors were encountered: