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
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.
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.
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:
This actually works correctly in Visual Studio 2019 for classes if it is a class that is valid for the current context (i.e. Doesn't exist in a namespace not in the current class namespace or in the using statements for the file).
Here is my example snippet
Snippet Definition
Snippet Use
And here is an example where I use two different classes as the second snippet, one that is a valid class name and works to use tab to autocomplete, and one doesn't work because the class requires adding an additional namespace using statement that is currently missing from the file:
So I see two options.
Use the sucky to cancel any auto-complete logic.
Ensure you have the proper using statements. You can even add using statements to your snippet using the imports declaration:
Visual Studio has Snippet Designer extension available for creating and managing custom code snippets. Is there something like this extension for Intellij Idea 13, or a way to simply add custom code snippets?
There's no extension that I'm aware of (and I'm not familiar with Snippet Designer), but that functionality exists in IntelliJ Idea.
Hit Preferences and start typing to find "Live Templates". Expand one of the existing ones to see some of the available functionality. You can set tab stops, cursor position, references to local variables. It's very handy.
In my visual studio sharepoint 2010 visual web part project, while creating the project, I typed the name that I want, yet when it went to the class file for editing, the namespace code says:
namespace PDFLibrary.VisualWebPart1
The PDFLibrary is the name I put which is ok, but I want to rename VisualWebPart1 if possible.
Does anyone know how to do this? Please share if this is possible.
Thanks.
You can select the VisualWebPart part of the name and right click it, then select Refactor->Rename, or select that part and press Ctrl+R+R which should have the same effect.
You can also use "search and replace" in entire solution. Just search all "PDFLibrary.VisualWebPart1" in your solution and replace with your new string. This is what Refacor -> Rename does as well.
This kind of stuff exists in Eclipse:
But I've not found it in Visual Studio yet. Is there such a window to show code outline at all?
I tried both Document Outline and Class View windows. The Class View is close, but it only shows class information, can it come up with function info also?
One great plugin for VS is CodeMaid. It is powerful and it is open source!
You can also sort your methods within the CodeMaid Spade view.
Here is a screenshot.
Also non-free, but Jetbrains Resharper provides a File Structure Window, what perhaps is what you are searching for.
To display this dockable window, select from the menu: ReSharper → Windows → File Structure (default shortcut Ctrl+Alt+F
This question was asked quite a while ago and before Visual Studio Code existed but I found it when searching for how to do this with Visual Studio Code so I thought others might stumble on this question too so I thought I'd share my solution. Here's how to do it in Visual Studio Code. I'm using TypeScript but it works for JavaScript, too.
1) View -> Open View
2) select (or type) Outline
3) You'll now get an Outline palette that shows full information on the class including properties and functions.
In newer Visual Studio versions (e.g. 2015) you can see this directly in the solution explorer. Simply expand the .cs file and you will get the list of the methods in the order they are listed in the file. This is exactly the same as the Outline in Eclipse.
If you want to see the stuff alphabetically, open the file and between the tab pane and the editor, there is a row showing the project name, the class name with namespace, and a drop down with the available methods and properties.
not free, but if you install Visual AssistX, each document gets a dropdown box listing all methods in a file (alphabetically or in the order they occur)
check Class View again, it does show functions (but not per document). Also check out the Code Definition Window, extremely nice when combined with Class View.
You can use the Class View Window, or you can use outlining to collapse the code window to definitions (Ctrl-M-O and Ctrl M-L in the standard keyboard set up)
Trick is to call Ctrl+F2, then Tab, then Tab, then Down arrow. I've done it with this simple AutoHotkey script when I hit Ctrl+o:
#IfWinActive ahk_exe devenv.exe
^o::
Send ^{F2}
Send {Tab}
Send {Tab}
Send {Down}
return
#IfWinActive
It will show dropdown that is closest to Quick Outline in Eclipse or others.
There is now a free add-in available through the add-in manager in VS2010 that works quite well. It also has a dark theme.
VS10x Code Map v2
Screenshot:
Go To "Solution Explorer" and select your project; then select a class file you want to outline, then expand the little triangle just below that class (as shown in the figure below)
In VS2017 you can navigate between items in the file directly from the upper right corner of the Editor.
you can have document outline window by going to view-> Other Window -> Document Outline or you can have it using Ctrl+W, U
I am using VS-2008. You can have a look at the following links also:
http://wildermuth.com/2008/06/06/The_Document_Outline_in_Visual_Studio_2008
http://dotnetkicks.com/tipsandtricks/Visual_Studio_2008_Document_Outline_Split_View
Hope this answers your question.
// 2019 answer
There is an free extension for Visual Studio that provide code outline: https://marketplace.visualstudio.com/items?itemName=SamirBoulema.CodeNav
I've started using VSCommands 10.
This has support for the most common languages used when developing in Visual Studio 2010, including JavaScript.
There's an extension provided Free, by Microsoft, that enables this and many other features into Visual Studio. The extension is Productivity Power Tools.
Ctrl+Shift+O comes closest to what you want
If you need more, see: discussion of the Outline Feature on github
If you use PHP, make sure you install full version as mentioned in the docs
Resharper has a feature of inspection. You can see incoming and outgoing calls from there.
shortcut: CTRL+ Shift + ALT +
A list of things you can use:
1.Visual Studio default's ClassView
2.Visual Assist's VA OUTLINE Feature
3.CodeMaid's Spade Feature
In Visual Studio Code, the popup outline is not called outline but symbol list. The command is "Go to Symbol in Editor...", and default shortcut is "Ctrl + Shift + O".
Checked again, the question is to Visual Studio, I guess it could be same with Visual Studio Code.
When you type the override keyword in a C# file in VS and press Space, you get a second menu offering the method to override. Can I extend this behavior with my own custom code that would use another keyword to pop up my own list of actions?
Yes it is possible to augment the list with more keywords or to even create your own list entirely. The interface you are looking for in Visual Studio 2010 is ICompletionSource. This isn't a simple interface though and it's hard to give a full sample in a stackoverflow answer but there are plenty of samples online to take a look at.
I think the best place to start is the editor samples available on codeplex
http://editorsamples.codeplex.com/
What other keyword do you want to use? If it's C#, pressing ctrl+space will open the auto-complete/intellisense menu.
If this is for writing another language using Visual Studio, perhaps this video is of use.
Here's the extending Visual Studio start page, in case it's helpful.