Open EnigmaCurry opened 2 years ago
If I rename ~/git/vendor
to ~/git/vendor2
it works.
Just looked into this.
I don't think this ever worked. Or at least I reproduced it and tried to bisect all the way back to gopls/v0.7.0 (approximately as far back as one can go without running into build problems), and it seems to have always been a problem.
We should and will still fix, though perhaps with less urgency than if this were a recent regression.
Change https://go.dev/cl/419111 mentions this issue: internal/lsp/cache: check for /vendor/ relative to workspace root
Have to move on for now, but https://go.dev/cl/419111 contains a sketch of a solution: when checking if a file is "vendored" (generally used to detect that we don't care about it), consider paths relative to workspace root. This makes the included regression test pass, and might be sufficient, but it requires some analysis (and we'll see if other tests pass).
It seems quite possible that this CL is insufficent though. Perhaps we want to consider paths relative to module root, not workspace root.
What did you do?
I created a simple go program:
If I put the source code in the path
~/git/vendor/enigmacurry/go-play/hello.go
, using gopls to complete on line 8 directly afterfmt.
it does not yield valid candidates for completion offmt
. Instead, it gives me these completions:However, if I put the same source code in a different directory,
~/git/go-play/hello.go
, completion is working correctly:I have created two gopls debug logs:
~/git/vendor/enigmacurry/go-play/hello.go
(see lines 309-314)~/git/go-play/hello.go
(see lines 211-216)I have tested in a total of three environments:
All environments showed the same result. I have replicated the problem on two separate machines (Arch Linux and Manjaro).
What did you expect to see?
I expected to see valid completions of
fmt
in both files in both sessions in both directories.What did you see instead?
The source in
~/git/vendor/enigmacurry/go-play/hello.go
does not offer valid completions.The parent directory
~/git/vendor
hosts many other repositories totaling 18GB, which may be a factor as this bug appears to be directory specific.Build info
gopls is installed directly from the Arch Linux repository: