-
Notifications
You must be signed in to change notification settings - Fork 645
Go to definition fails the second time, when the first time is on a sub module #2296
Comments
This is probably because we are using the root folder i.e the one mapping to the main module, when running the At this time, all we know is the file for the which the operation is being made i.e the one from module cache. For such case, we fall back to the project root folder as the working directory. Because by this time, we have lost the context that we landed in the current file from the sub module. |
hi, is there any plan to fix this?~ @ramya-rao-a |
@clor09 There is no good solution at hand at the moment, ideas are welcome |
Does the language server protocol have some support for communicating the root? Could paths be munged somehow to give the language server an idea that we are looking at a submodule? This feature is the one holding me back from switching from gocode+vendor to gopls+modules. CC @stamblerre |
@jellevandenhooff: This should work correctly now in @ramya-rao-a: This issue could probably be closed since modules support will be provided through |
Yes, it totally works now! Thanks! |
Closing this issue as the recommendation for modules is to use the language server |
Sample repo: https://github.com/kidlj/demo
main.go
file in the sub module forgin
Go to definition
on any of the symbols from the context package. (This doesnt work in 0.8.0, but will work on the beta package of 0.8.1)Go to definition
again on any of the symbols from the context package.This fails with the error
godef: There must be at least one package that contains the file
The text was updated successfully, but these errors were encountered: