选项卡行为 Resharper Intellisense 选项

发布于 2024-12-27 15:20:04 字数 610 浏览 1 评论 0 原文

像 Resharper 这样的产品有很多设置,但我似乎无法找到正确的设置来获得我想要的确切行为。

我试图改变的行为是这样的: 假设我想要的最终结果是

在此处输入图像描述

但当前行是

在此处输入图像描述

正如您所期望的,我开始输入:

在此处输入图像描述

并在选项卡后我得到这个

在此处输入图像描述

但我希望它变成

在此处输入图像描述

有谁知道如何更改 Resharper 设置以实现我想要的行为? 谢谢。

编辑:请注意,该选项卡确实在默认 VS Intellisense 中执行所需的行为。

A product like Resharper has many settings, and I can't seem to find the right settings to get the exact behavior I desire from it.

The behavior I am trying to change is this:
Suppose the endresult I want is

enter image description here

but the line currently is

enter image description here

As you expect I start typing:

enter image description here

and after a tab I get this

enter image description here

but I wanted it to become

enter image description here

Does anyone know how I can change the Resharper settings in such a manner that my desired behavior is realized?
Thank you.

EDIT: Note that tab does perform the desired behavior in the default VS Intellisense.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隔岸观火 2025-01-03 15:20:04

在这种特殊情况下,您应该执行以下操作:

  • 转到 ReSharper >选项>环境>智能感知> IntelliSense 行为,并将完成后自动插入括号设置为仅打开
  • 现在,在 SomeMethod() 之前插入脱字符号,输入 Math.Ab,然后按 Enter 完成 Abs ,正如 Rob H 所正确建议的那样。您最终会得到 Math.Abs​​(SomeMethod();
  • 最后,按 Ctrl+Shift+Enter 调用 完整语句,在本例中将在语句末尾插入所需的括号,并将插入符号放在 方案

请记住,如果您可能有很多其他的代码完成用法,如果需要进行多次类似的代码修改,则这可能不是最佳解决

。地方,您应该创建一个搜索和替换模式 相反。

In this particular case, here's what you should do:

  • Go to ReSharper > Options > Environment > IntelliSense > IntelliSense Behavior, and set Automatically insert parentheses after completion to Opening only.
  • Now, with the caret right before SomeMethod(), type in Math.Ab, and complete Abs with Enter, as correctly suggested by Rob H. You'll end up with Math.Abs(SomeMethod();
  • Finally, press Ctrl+Shift+Enter to invoke the Complete Statement, which in this case will insert the required parenthesis at the end of the statement, and put the caret on the next line.

Keep in mind though that this might not be the optimal solution provided that you probably have plenty of other usages of code completion that could conflict with this kind of settings change.

If that kind of similar code modification is required in multiple places, you should possibly create a search and replace pattern instead.

缘字诀 2025-01-03 15:20:04

按 Enter 键而不是 Tab 键将插入而不覆盖,尽管最终会得到

Math.Abs()SomeMethod();

Hitting Enter instead of Tab will insert without overwriting, although you then end up with

Math.Abs()SomeMethod();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文