由于某种原因,我使用dotnet创建的所有新项目都不再具有intellisense或squiggles。然而,如果我打开一个旧的项目,那些仍然有智能感知和squiggles。
如何在我的新项目中获得intellisense和squiggles?
在Linux中使用C# (Ubuntu20.04)。
版本
Visual代码1.60.0 C#用于Cisual Studio代码(由OmniSharp驱动) 1.23.15
dotnet -列表-sdks 5.0.400 /usr/share/dotnet/sdk
dotnet -列表-运行时/usr/share/dotnet/shared/Microsoft.AspNetCore.App Microsoft.AspNetCore.App 5.0.9 Microsoft.NETCore.App 5.0.9 /usr/share/dotnet/shared/Microsoft.NETCore.App
命令使用
dotnet新控制台-o project_name
发布于 2021-09-14 14:01:09
如果您有一个工作区,并且由于某种原因有多个文件夹,您可能需要“帮助”omnisharp一点。最初,我有一个大项目,并为它添加了一个解决方案--最后添加了两个工作区文件夹(一个用于启动项目,另一个用于解决方案)。在编写了该设置之后,我只经历了第一个让intellisense工作的项目。
让intellisense起作用的解决方案是确保omnisharp从解决方案而不是项目中获得成功:
从“斯瓦纳”中得到的灵感:https://github.com/OmniSharp/omnisharp-vscode/issues/1889
您可以在设置和键绑定中自定义IntelliSense体验。
下面显示的设置是默认设置。您可以在settings.json文件中更改这些设置。
{
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
// Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.
"editor.acceptSuggestionOnCommitCharacter": true,
// Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change
"editor.acceptSuggestionOnEnter": "on",
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": true,
// Controls if pressing tab inserts the best suggestion and if tab cycles through other suggestions
"editor.tabCompletion": "off",
// Controls whether sorting favours words that appear close to the cursor
"editor.suggest.localityBonus": true,
// Controls how suggestions are pre-selected when showing the suggest list
"editor.suggestSelection": "recentlyUsed",
// Enable word based suggestions
"editor.wordBasedSuggestions": true,
// Enable parameter hints
"editor.parameterHints.enabled": true,
}
检查这两个设置是否正确设置:
"editor.quickSuggestions": true,
"editor.suggestOnTriggerCharacters": true
https://stackoverflow.com/questions/69142607
复制相似问题