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
x/tools/gopls: VSCode with go module suddenly shows undeclared name: L LSP[line, character] #33477
Comments
Can you please share your Also, can you try |
Also, please note that you have to open VSCode at the module root, i.e., with the directory that contains the |
First, there is no go.mod since on this specific project I am not using go.mod and it's the same in many other projects which works perfectly fine. I assume it's something local to the Desktop I am working.
I am sure that if it works as expected on a clean system so, maybe I missed something on my cleanup? Which cleaned up anything VSCode has in my local user directory and now it works as expected.
|
Works after a full VSCode local settings directory cleanup. |
|
Related: |
And in the case I am not working with a git or using a local git? |
@elico I just tried it for my env, and in this case you should be able to set The reason that deleting the settings was working for people seems to be because it defaulted this setting back to false. VSCode may prompt you to use the LSP, If you aren't working with Git, but want to use the newer LSP based code checks ( |
|
Alright so I don't think there is any issue. I was experiencing #33107 (comment) 😅 I think this issue can be closed as it seems to represent environment issues rather than a bug. Although, VSCode / gopls could give better error messaging, or rather VSCode should expose the logs of gopls more directly when there is an issue. If troubleshooting these kinds of issues is time consuming for other people as well, perhaps this should be a VSCode feature request to expose gopls error logs directly in the VSCode console. Not sure if that would make sense. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, but only on my current Ubuntu 18.04, on a fresh Debian 10 it works as expected.
What operating system and processor architecture are you using (
go env
)?Ubuntu 18.04
go env
OutputWhat did you do?
Open Visual Studio Code.
Add the project folder V1.
Add three new xyz.go files into the project folder making it a basic V2
Opened one of the new files
tls.go
What did you expect to see?
I expected the go module which uses gopls to show missing variables and other parts of the code as errors.
What did you see instead?
An screenshot link:
https://pasteboard.co/IrkFAnp.png
Lots of error lines such as below which ends with the source as LSP:
The text was updated successfully, but these errors were encountered: