-
Notifications
You must be signed in to change notification settings - Fork 645
gopls code completion doesn't work in multi-language project #2490
Comments
Thanks for reporting @thekvs This is very similar to the issue #2431 and is a limitation on @stamblerre Do you think that the extension should try and run |
@ramya-rao-a FWIW, I'm planning to modify vim-go so that it will use the |
Now vim-go works as I would expect it from the user's point of view. @ramya-rao-a can you please consider implementing similar behavior for vscode-go? |
@bhcleek Thanks for that tip. Do you plan to restart the language server when user moves to a file that belongs to a different module? @thekvs Yes, this is something that we can definitely consider doing. The only caveat is that the language server needs to be started right when the extension activates. This means that if you are working on a Go file belonging to one module, and then open another file belonging to another module (say you have a folder with multiple sub modules), then we need to restart the language server. Right now, am not aware of a way to do this without forcing a VS Code window reload. @stamblerre, @ianthehat any thoughts here regarding if the language server can be told to switch the module directory it is using? |
You should not need to restart the language server (and doing so in general is a bad idea, we hold some very expensive to re-calculate caches inside gopls, that is what makes it so fast). |
@ramya-rao-a I don't plan to update vim-go to restart gopls in that case. I will mostly likely be adding an explicit way for user's to indicate what their rootUri is; it's currently derived from the first Go file that they open in Vim. Later, I plan to add support for letting users add workspace folders dynamically. |
@ianthehat So, when |
for every query gopls attempts to pick the view that contains the file most tightly (to cope with nested modules). |
That's great to know, thanks @ianthehat Keeping this issue open just in case there is any extra work to be done from our side. |
Merged. |
As far as I understand current state we are still waiting for necessary changes in |
@thekvs I believe the work in @ianthehat, @stamblerre Is there anything to be done from the vscode go plugin's side (other than updating to the latest gopls) to make this work? |
I am asking because I've updated to the latest gopls but nothing seems to have changes in VSCode's behavior. Do I need to tweak some settings? |
I am facing the exact same issue. Using a monorepo with different languages. Any update? Something I can do? |
@tkvw For now I'm opening each directory as its own workspace but in the same window (i.e. |
@haggen: I'm doing the same (own workspace), not sure what |
@tkvw Assuming you're launching Code from the Terminal:
|
@haggen : yeah I can read the command help 😄 , still not sure what is does?
What I am currently doing is:
Problem is that I need to maintain two |
@ianthehat, @stamblerre, What do you need from the extension's side to make this work? |
I think this is similar to the issue with having to add a workspace root for each module - we use the root URI passed in by VSCode to hand to |
I were just about to post an issue on either gopls or this Github. What's the status on this so far @ramya-rao-a and @ianthehat? |
@stamblerre I believe we need an issue in gopls for this. In order to support mono repo with multiple Go projects (each a separate module), |
I created an issue here: golang/go#32394 |
Thanks @johan-lejdung |
Don't know if it is a
gopls
orvscode-go
issue, but since I mostly use VSCode nowadays I am reporting it here.I have a multi-language project, Go part lives in separate
go
folder (outside$GOPATH
), Python -- inpython
etc. So structure looks like:Code completion with
gopls
doesn't work when I first openproject
folder in VSCode then navigate togo
sub-folder and open Go file there, but does work when I directly opengo
folder in VSCode at the start of the session.I use modules In Go code, so structure looks like:
gocode-gomod
doesn't have this issue.I am using:
The text was updated successfully, but these errors were encountered: