Visual Studio 2017: Disable Intellisense for CodeS

2020-03-24 02:12发布

问题:

I'm using Visual Studio 2017 Enterprise, Version 15.3.3

I looks like IntelliSense has some new features for code completion. On of this feature is, that a field name is automatically suggested when a type is written.

SpacePosition s.. // starting with s, Intellisense suggest "space", "position" and "spacePosition"

I like this feature in general but not for code snippets. Using a code snipped I have the problem, that the name of a literal is automatically replaced by IntelliSense after pressing tab (which is used for navigate to the next literal).

In my example I want to name the property "other" and then jump the the next literal inside the snippet. But because of IntelliSense, the property name is replaced by "spacePosition".

Is there any way to disable the IntelliSense feature inside code snippets?

I found a solution for the same problem in Visual Studio Code: stackoverflow article but not for Visual Studio

回答1:

Disable the name suggestions in Tools/Options/TextEditor/C#/IntelliSense. That's what is causing this nonsense. Seems MS realized later that they flipped coders up by adding that feature that changes old behaviour greatly without giving them a way to disable it. Now there is such a checkbox. I nearly uninstalled this studio because of this lol. Not sure, may be it's a good feature, but i'm too used to Tab code snippets around, that I'm better without it.



回答2:

How to: Manage Code Snippets

To access the Code Snippets Manager

1.) On the Tools menu, click Code Snippets Manager. Shortcut Ctrl+K,Ctrl+B

How to: Change snippet behavior

To change snippet behavior.

1.) Go to Tools > Options > Text Editor > IntelliSense > Snippet Behavior

2.) See images.



回答3:

Now there has no such option to disable this intellisense feature inside code snippets, but you can try to click 'Esc' key after type 'other', then click 'Tab' key to jump to next literal, please check the following: