Tab behavior Resharper Intellisense Options

邮差的信 提交于 2019-12-10 12:59:10

问题


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

but the line currently is

As you expect I start typing:

and after a tab I get this

but I wanted it to become

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.


回答1:


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.




回答2:


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

Math.Abs()SomeMethod();


来源:https://stackoverflow.com/questions/8899190/tab-behavior-resharper-intellisense-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!