C#建议正在替换VS Code中的后续文本。为什么?

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

C# suggestions are replacing subsequent text in VS Code. Why?

问题

我的问题是,当我创建一个变量,比如 int,然后想要添加公共修饰符 public 时,单词 int 被删除了(我认为这是由于 C# 扩展的原因)。如果这不是在我按下空格时发生的话,这就不会成为一个问题。

当我按下空格键时,我应该能够不仅接受智能感知建议(在这种情况下是 "public"),还可以在建议和之前的单词之间添加一个空格。在上周的某次更新之前,这不是一个问题,但是VS Code 和 C# 扩展更新后出现了这个令人讨厌的变化。

有没有关于如何解决这个问题的建议?

我尝试将 "editor.suggest.insertMode": "insert" 添加到 settings.json 中,但显然问题不在那里。

英文:

My problem is that when I'm creating a variable, let's say int, and later I want to add the public modifier the word int gets deleted (I think the reason is due to the C# extension). This would not be a problem if this didn't happen when I press space.

When I press space, I should be able to not only accept the intellisense suggestion (in this case "public") but also add a space between the suggestion and the word that was before. This wasn't an issue before but VS Code and the C# extension had an update this week that brought this awful change.

Any suggestion of how can I solve this problem?

I tried adding "editor.suggest.insertMode": "insert" in settings.json, but apparently that's not where the problem is.

答案1

得分: 10

TL;DR 这是 C# 扩展中的一个错误。据称修复 在版本 1.26.0 中发布(来源)。尽管 显然在 v2.0.357 中再次出现问题

我谷歌搜索了"site:github.com/dotnet/vscode-csharp/issues replace"并找到了@id:editor.suggest.insertMode not honored #5801。那里的问题描述似乎与您所描述的情况相符。您可以给该问题标记点赞以表示支持,并订阅以获取有关讨论和进展的通知。请避免发表嘈杂的评论,如"+1"。我已经订阅了该问题并将在有新信息时更新此回答。

在 VS Code 1.79 中更改了有关自动完成的某些行为,导致某些扩展出现了不同的行为。VS Code 建议在扩展的一侧修复这些问题。另请参见1.79 中的单词起始字符上的完成触发行为更改 #185286

英文:

TL;DR This is a bug in the C# extension. A purported fix was released in version 1.26.0 (source). Though apparently it has broken again in v2.0.357.

I googled "site:github.com/dotnet/vscode-csharp/issues replace" and found @id:editor.suggest.insertMode not honored #5801. The description of the issue there seems to match what you have described. You can give the issue ticket a thumbs up to show support for it, and subscribe to it to get notified about discussion and progress. Please avoid making noisy comments like "+1". I'm subscribed to the issue ticket and will update this answer post as new information arrives.

Some sort of behaviour about completions was changed in VS Code 1.79 that has caused some extensions to have this different behaviour. VS Code is recommending that the issues be fixed on the extension side of things. See also Completion trigger behavior on word start characters changed in 1.79 #185286.

答案2

得分: -2

根据 VS Code 文档
您可以将以下设置设置为 false:

"editor.acceptSuggestionOnCommitCharacter": false
英文:

Based on VS code docs
What you can do is set the following setting to false:

"editor.acceptSuggestionOnCommitCharacter": false

huangapple
  • 本文由 发表于 2023年6月15日 01:17:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76476072.html
匿名

发表评论

匿名网友

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

确定