VSCode Go没有智能感知。

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

vscode go no intellisense

问题

这是我的配置:

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

当我输入'fmt.'时,应该推断出fmt包的方法,例如Println(),但它没有显示出来(请参见屏幕录像视频)
https://i.imgur.com/3DHcFAf.mp4

英文:

These are my configurations:

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

VSCode Go没有智能感知。

When I typed 'fmt.', it should infer the method of fmt pkg, for example: Println(), but it didn't shows up(see the screen record video)
https://i.imgur.com/3DHcFAf.mp4

答案1

得分: 1

尝试重新加载窗口

按下F1并搜索Developer: Reload window

以下是我的步骤:

  1. 在VScode中打开一个新文件
  2. 将语言模式更改为go
  3. 另存为main.go
  4. 编写与您相同的代码(在编写fmt.之后没有自动完成)
  5. 重新加载窗口
  6. 输入fmt.,窗口中会打开建议

看起来,VScode在文件创建后不会立即提供所有特定于语言的功能,但如果文件在VScode加载时已经存在,扩展将按预期工作

如果这样还不起作用,请检查您的语言服务器设置。
您可以按下F1并选择Preferences: Open Settings (JSON)来查看您的设置的JSON。

检查是否有以"go.useLanguageServer"开头的行。

英文:

Try reloading the window

Press F1 and search for Developer: Reload window

These were my steps

  1. Open a new file in VScode
  2. Change the language mode to go
  3. Save as main.go
  4. Wrote the same code you did (after writing fmt. there was no autocomplete)
  5. Reloaded the window
  6. Typed fmt. and the window with the suggestions opened up

It seems that VScode doesn't immediately provide all language-specific features as soon as the file is created, but if the file is already there when VScode is loading, the extensions work as they should

If that isn't working, check your language server settings.
You can see the JSON of your settings by pressing F1 and selecting Preferences: Open Settings (JSON)

Check if you have a line that starts with "go.useLanguageServer"

huangapple
  • 本文由 发表于 2021年6月15日 15:10:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/67981601.html
匿名

发表评论

匿名网友

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

确定