首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >失落的智慧和诡计

失落的智慧和诡计
EN

Stack Overflow用户
提问于 2021-09-11 11:37:19
回答 1查看 149关注 0票数 3

由于某种原因,我使用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

EN

回答 1

Stack Overflow用户

发布于 2021-09-14 14:01:09

如果您有一个工作区,并且由于某种原因有多个文件夹,您可能需要“帮助”omnisharp一点。最初,我有一个大项目,并为它添加了一个解决方案--最后添加了两个工作区文件夹(一个用于启动项目,另一个用于解决方案)。在编写了该设置之后,我只经历了第一个让intellisense工作的项目。

让intellisense起作用的解决方案是确保omnisharp从解决方案而不是项目中获得成功:

  1. Ctrl + Shift +p
  2. 写"OmniSharp: Select“并按Enter。
  3. 选择解决方案工作区条目.

从“斯瓦纳”中得到的灵感:https://github.com/OmniSharp/omnisharp-vscode/issues/1889

您可以在设置和键绑定中自定义IntelliSense体验。

下面显示的设置是默认设置。您可以在settings.json文件中更改这些设置。

代码语言:javascript
运行
复制
{
// 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,
}

检查这两个设置是否正确设置:

代码语言:javascript
运行
复制
"editor.quickSuggestions": true,
"editor.suggestOnTriggerCharacters": true
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69142607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档