英文:
vscode go no intellisense
问题
这是我的配置:
当我输入'fmt.'时,应该推断出fmt包的方法,例如Println(),但它没有显示出来(请参见屏幕录像视频)
https://i.imgur.com/3DHcFAf.mp4
英文:
These are my configurations:
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
以下是我的步骤:
- 在VScode中打开一个新文件
- 将语言模式更改为go
- 另存为main.go
- 编写与您相同的代码(在编写fmt.之后没有自动完成)
- 重新加载窗口
- 输入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
- Open a new file in VScode
- Change the language mode to go
- Save as main.go
- Wrote the same code you did (after writing fmt. there was no autocomplete)
- Reloaded the window
- 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"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论