如果在我的 VS Code Golang 项目中自动完成功能不起作用,我该怎么办?

huangapple go评论74阅读模式
英文:

What do i do if autocomplete doesn't work in my vs code golang project?

问题

简单的建议,比如“重新启动VS Code”或“重新安装工具”并没有任何区别。

当我输入内容时,我得到的结果就像这个图片中的那样。

问题不在于Intellisense本身,因为当我在HTML或CSS文件中工作时,自动完成功能完美运行。

我在互联网上找到的所有信息都没有帮助我,所以我决定在这里寻求帮助。

英文:

The simple advices like to restart VS Code or to reinstall the tools do not make any difference.

When I type in something, I get the result like in this
image.

The problem is not in the Intellisense itself, because when I work in my html or css files, autocomplete works perfectly

All the information I found in the internet hasn't helped me so I've decided to search for help here.

答案1

得分: 5

当你在另一个导入的项目的源文件中时,就会发生这种情况,超出了你的主项目。

例如,如果你有一个名为"test1"的文件夹中的项目,它导入了一个包,比如import "test2"。你在VSCode中打开了test1文件夹,然后通过在基于test2的函数上按Ctrl+单击来导航到test2的文件中。然后在这个文件中,代码检查器将无法帮助你,因为你不在test2项目中。你需要在test2文件夹中打开另一个VSCode才能使其工作。

英文:

This happens when you are in an another imported project's source file, outside of your main project.

For example if you have a project in a folder like "test1" that imports a package, like import "test2". You open your test1 folder in VSCode, then navigate into a file from test2 for example with a Ctrl+Click on a test2 based func. Then in this file the linter will not help you, since you are not in the test2 project. You need to open another VSCode in test2 folder to have it work.

答案2

得分: 0

只要文件中的其他地方存在语法错误,行为也可能发生。
请确保文件中没有与编译器相关的语法错误。

英文:

As long as there are any syntax errors somewhere else in the file, the behavior might also take place.
Please make sure there are no compiler relevant syntax errors in the file.

huangapple
  • 本文由 发表于 2022年3月2日 01:32:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/71312460.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定