I recently switched to Visual Studio Code and I love it! It starts so quickly andI just enjoy the open source environment more than Visual Studio. But there's one problem that I have encountered that bothers me more than it should.
Before I could if I wanted to autocomplete the syntax for an if statement I'd just be able to type in "if" and touble tap tab, but now the autocompletion IntelliSense things pop up in the wrong order:
The red box is the wrong one that gets displayed first and the green box is the one I want at the top. My question is if there's a way to configure it so that I get that statement at the top. It's the same with for-loops, foreach-loops and pretty much every other autocompletion that I want to use.
Create snippet (or edit) ctrl+shift+p Preferences: Configure User Snippets
settings (ctrl+,)
"editor.snippetSuggestions": "top",
Hey all I have been searching Google for a while now trying to find anything on how to go about setting up you're own button on the VS toolbar.
What I am talking about is this:
And when I click on that button I would like to be able to execute some C# code.
As an example, say I had the word "HELLO" highlighted and I pushed on that button on the toolbar and I wrote some code behind it that, when pressed, have whatever is highlighted turn bold and change color from normal BLACK to .
I was originally thinking that it was called Visual Studio Extensibility Tools but that doesn't seem to be what I am looking for here - it seemed more as a Nuget plugin type of thing?
I'm looking for more like what you can do with the Office suite of products within VS addins - As in make a button for Outlooks toolbar, etc..
The only remotely close thing I could find so far would be this.
If anyone has done this before or at least know what to search for then please let me know!
You were on the right track with Visual Studio Extensiblilty tools.
There are several steps.
Create the Toolbar and add the button.
Create the event handler that runs when the button is clicked.
Determine what document has focus (c# doc, xml doc, vb doc, etc.)
Determine what is selected in the document.
Change the code formatting
Start with an overview of the Extensions SDK.
Here's how to create a toolbar with the VS extensions.
Creating a Toolbar for the IDE
NOTE The keyword here is "default". I know I can hit escape and the default behavior gets aborted. I don't want to hit the escape key every time the IDE thinks it knows what I want. I didn't have to do this in 2013.
ADDENDUM 2 It seems I'm still having difficulty communicating what I'm after here. What I want to happen is nothing when I press the space bar... I just want a space character to show up on my screen. The only time I want the IDE to actually insert a suggestion is when I hit the tab bar. I hope that's clearer?
This is driving me nuts. 2013 and before allowed you to set completion characters (maybe that was resharper?) But in 2015 I see no way to stop the default behavior of autocomplete.
For example, say I have a class Foo, but I don't have the namespace specified already, yet I have a class FooBar in one of the specified namespaces, if I type:
public void DoSomething(Foo// <-- then a space)
...it automatically puts FooBar. How the heck do I turn off this behavior?
I should mention that I still want Autocomplete, just on tab though.
Edit -> Intellisense -> Toggle Completion Mode
From : https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx
"You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode."
For all who have the same problem in Visual Studio Code, add this line to the User Settings:
"editor.acceptSuggestionOnCommitCharacter": false
change the setting for Editor: Accept Suggestion On Enter to off
If you're using Resharper and Visual studio 2017, you may need to use a combination of the existing answers to stop getting the autocomplete behaviour when pressing space. This is too long for a comment so added an answer.
Make sure in Visual studio that intellisense Toggle Complete Mode is off/unselected (as noted in other answers). Note: If you turn on the "Text editor" icons in the VS toolbar at the top, you'll see an extra icon that gets highlighted on and off showing you whether intellisense is toggled on or off.
AND
In the resharper dropdown on the toolbar (Resharper > Options...), Go to IntelliSense > Completing Charactes > and then uncheck the "Complete on space" box for C#.
Now autocomplete doesn't occur when pressing space (can still use tab, etc to autocomplete).
(Related aside: This autocomplete on space is really bad if you use VSVim, because you can't by default use the typically vim ESC key to 'get out' of the autocomplete mode. e.g. it's very difficult to even type in the static modifier for a variable/function without it changing to some other autocomplete choice.)
If you use Vs2017 and the setting resets everytime you launch Vs, i created a small script that automatically disables space completion at launch using Visual Commander Extension:
enter link description here
Visual Studio 2019 Pro -> Options -> Text Editor -> Advanced -> disable "Responsive code completion"
This disables Completion Mode, but doesn't take effect when VS is restarted.
You have to enable & disable it again after each restart, which is worse than using the Toggle Completion Mode menu option.
Since it is in Options, it is probably supposed to be a permanent setting.
Since Visual Studio is constantly changing, I imagine there will constantly be new answers for this. None of the other answers worked for me on Visual Studio 2019 Community Edition. What did work (as of January 2022) was:
Edit > IntelliSense > Switch between automatic and tab-only
IntelliSense completion
Alternatively, you can just toggle it with Ctrl+Alt+Space. Hopefully this helps someone else. Also, I've noticed Visual Studio doesn't seem to remember this setting, and I've had to toggle it again the next time I used VS.
For those looking for the same thing in VSCode (2022)
File -> Preferences -> Settings and search for Accept Suggestion On Commit Character.
Make sure this setting is unchecked:
For the current version of Visual Studio Code (2020), you can change to suggestion mode by going to File > Preferences > Settings and then going to Extensions > TypeScript and then checking TypeScript: Disable Automatic Type Acquisition. Or, after going to Settings, you can search for "Type Acquisition" in "Search Settings" and then check TypeScript: Disable Automatic Type Acquisition.
Default IntelliSense completion mode
Another option for VS19 Enterprise:
Visual Studio 2019 Enterprise -> Options -> Text Editor -> Advanced -> Default IntelliSense completion mode -> Dropdown -> Tab-only
I just did this in Visual Studio by going to:
File > Preferences > Settings > toggle "Suggest on Trigger Characters"
I also toggled off "Auto Suggestion on Commit Character" and "Accept Suggestion on Enter"
- however you may want those settings.
I am trying to put line numbers in Visual Studio.
Usually I go for
Tools -> Options -> Text Editor -> C#
A new machine was assigned to me with preinstalled VS 2008. I am unable to find the C# option.
Any solution ? Thanks in Advance
First, you need to check the box labeled "Show all settings" in the lower left-hand corner.
Then, you can expand "Text Editor", select "C#", and check "Line numbers". (You can also enable this setting for all languages, rather than individual ones, if you prefer.)
And while you're at it, you probably want to crank up "Animate environment tools" to the max. No point in waiting around on the IDE to show pretty animations when you have code to write!
Check the "Show All Settings" checkbox at the bottom of the dialog. It should then show all supported languages, although you may be better setting "All Languages" rather than setting it for each individual language..
What is the keyboard shortcut to get CodeRush to do the #1 suggested fix for the situation?
Do I really have to hover over the problem long enough to get the ellipse to show up and then pick a choice?
Also is there a way to jump to the next problem area?
In the DevExpress options (under DevExpress > Options), there's a "IDE" section and a "shortcuts" subsection.
In there, you probably already have a keyboard shortcut defined for in the "Refactor" category for the "Refactor" command - that keyboard shortcut would bring up that selection box, and pressing Enter will then select the first option in that dialog box, by default.
If you notice a delay contact support#devexpress.com and send some details to help us reproduce. Also, CodeRush doesn't interfere with Intellisense, but uninstalling other third-party IDE tools has been known to suppress Intellisense and this may be what happened to you. Try this: Open up the Visual Studio Tools menu then Text Editor and then C#. On that options page you will need to recheck "Auto list members" and "Parameter information" to get Intellisense reenabled.