Introduction
IntelliSense is the general term used to refer to a number of features found in Visual Studio: List Members,
Parameter Info, Quick Info, and Complete Word. These features help you
to learn more about the code you are using, keep track of the parameters
you are typing, and add calls to properties and methods with only a few
keystrokes. Figure 1 shows the IntelliSense menu options and their
keyboard shortcuts. You will find the IntelliSense menu option at the
bottom of the Edit menu.
IntelliSense Features
List Members
List Members is an IntelliSense feature whereby
when you type a trigger character in any of the Visual Studio
code editors, a list will appear displaying valid members for
the type (or namespace) you are typing. In the case of VSEW this
means you have List Members support for HTML
(including HTML5), CSS (including CSS3), JavaScript, ASP.NET, C#, SQL, or Visual Basic.
Keyboard shortcut: Ctrl + J.
Once item is selected press Tab or
Spacebar on your keyboard to insert the code. You can use Page
Up or Page Down on your keyboard to scroll through long member
lists.
To turn List Members off by default (so that it does not appear
unless specifically invoked), go to Tools/Options/All Languages and deselect Auto list members. If you want to turn off List Members only for a specific language, go to the General settings for that
language.
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.
Parameter Info
Parameter Info gives you information about the number, names,
and types of parameters required by a method, attribute generic
type parameter (in C#), or template (in C++).
The parameter in bold indicates the next parameter that is
required as you type.
Quick Info
Quick Info does just that, it provides quick info about a selected member in a list as shown in figure 1.
Keyboard shortcut: Ctrl + I.
Complete Word
Complete Word completes the rest of a variable, command, or
function name once you have entered enough characters to
disambiguate the term. You can invoke Complete Word by
clicking Edit/IntelliSense/Complete
Word, typing CTRL+SPACE, or clicking the Complete Word button on the editor
toolbar.
Code Snippets
Code Snippets is a very cool feature of Visual Studio, it allows you to
quickly pastes blocks of code into your source documents at your
request and the snippets themselves are built in such a way as
to expedite completion of the entire snippet of code.
Insert Code Snippet
One way to add a snippet of code is to insert it in one of Visual Studios code editors. Click in the Source code, then press Ctrl+K followed by Ctrl+X on your keyboard, this will open the Insert Snippet box which will allow you to select a code snippet for any of the languages you have available to the document you are editing. Open one of the language folders and select from the choices that appear.
Code Completion
One way to insert a snippet is to type the keyword
associated with the snippet and then press the Tab
key on the keyboard. In figure 5 you see the keyword style type
into the head section of an HTML document. In figure 6 you see
the results after the Tab key is pressed - a
completely formed HTML <style>
element was created by Visual
Studio. The same is true of code snippets like <audio>
, the entire
element block is created.
Surround With Code Snippet
In order to quickly convert text to any HTML element, you can
simply select the block of text and then surround it with a code
snippet by typing the key sequence Ctrl+K, Ctrl+S on your
keyboard. This will bring up the Surround With: box with a
Members List attached to it (as shown in figures 7 & 8). At this
point you have several choices, you can type a letter that
matches an item in the Member's List (in the figure 9 example
that would be an a for ASP.NET or an h
for HTML), use the arrow keys on your keyboard to navigate to a
folder in the Member's List, or use your mouse to click on one
of the folders in the member's list. Then press the Enter key on your keyboard to open the selected folder or
double-click the folder. Then use the same methods just describe
to select a code snippet and press Enter or double click on it
to insert the code.
Once the code is inserted into your document, some of them
require you to type additional information to complete the
process. For example, in the case the audio HTML element there
are two src attributes that need values assigned to them. Once
you insert the code snippet for the audio block you will notice
that the file name of the first source element's src attribute
is highlighted. All you have to do is type the actual name of
the image file and press the Enter key. Visual Studio assigns
the same file name to the second source element's src attribute
and places your insertion point at the end of the audio
element's block of code. A real time-saving feature once you get
used to using it.
Help With Code Snippets
MSDN: How to Use Surround-with Code Snippets
IntelliSense Icons (Babels)
When an IntelliSense context menu pops up with its list of
options you'll notice that many of the options have icons
identifying the option type. Keeping track what icons represent what
can be confusing. Here is a good table for reference.
Icon
|
Description
|
Icon
|
Description
|
|
Variables
|
|
Method or Function
|
|
Fields
|
|
Files
|
|
Type parameters
|
|
Folders
|
|
Constants
|
|
Colors
|
|
Classes
|
|
Unit
|
|
Interfaces
|
|
Snippet prefixes
|
|
Structures
|
|
Words
|
|
Events
|
|
Keywords
|
|
Modules
|
|
References
|
|
Properties & Atrributes
|
|
Values & Enumerations
|
|
Keywords
|
|
Code Snippet, vendor-specific properties in CSS editor.
|
Goto
https://code.visualstudio.com/docs/editor/intellisense
for the most up-to-date information.
Keyboard shortcut = Ctrl + . (period)
Peek View
Keyboard shortcut = Alt + F12