Overview
IntelliSense is VS Code’s intelligent code completion system that provides context-aware suggestions as you type. It combines syntax understanding, type information, and API documentation to help you write code faster and with fewer errors.
How It Works
IntelliSense is powered by language services that analyze your code in real-time. The suggestion engine uses fuzzy matching and scoring to provide the most relevant completions.
// From VS Code source: src/vs/editor/contrib/suggest/browser/suggest.ts
export class CompletionItem {
// Text label displayed in the suggestion widget
readonly textLabel : string ;
// Lower-case variants for performance
readonly labelLow : string ;
readonly sortTextLow ?: string ;
readonly filterTextLow ?: string ;
// Fuzzy matching score
score : FuzzyScore = FuzzyScore . Default ;
constructor (
readonly position : IPosition ,
readonly completion : languages . CompletionItem ,
readonly container : languages . CompletionList ,
readonly provider : languages . CompletionItemProvider
) {
this . textLabel = typeof completion . label === 'string'
? completion . label
: completion . label ?. label ;
this . labelLow = this . textLabel . toLowerCase ();
}
}
Triggering IntelliSense
Automatic Trigger
IntelliSense appears automatically as you type. Most languages trigger on identifier characters.
Manual Trigger
Press Ctrl+Space (Windows/Linux) or Cmd+Space (macOS) to manually invoke IntelliSense
Trigger Characters
Specific characters like . or -> trigger IntelliSense in appropriate contexts
The suggestion widget provides rich information about each completion item:
Widget Features
Icon : Indicates the type of symbol (function, variable, class, etc.)
Label : The main suggestion text
Details : Additional context like type information
Documentation : Full documentation in the details pane
Context Keys
The suggestion widget behavior is controlled by context keys:
export const Context = {
Visible: historyNavigationVisible ,
HasFocusedSuggestion: new RawContextKey < boolean >( 'suggestWidgetHasFocusedSuggestion' , false ),
DetailsVisible: new RawContextKey < boolean >( 'suggestWidgetDetailsVisible' , false ),
DetailsFocused: new RawContextKey < boolean >( 'suggestWidgetDetailsFocused' , false ),
MultipleSuggestions: new RawContextKey < boolean >( 'suggestWidgetMultipleSuggestions' , false ),
AcceptSuggestionsOnEnter: new RawContextKey < boolean >( 'acceptSuggestionOnEnter' , true ),
};
Keyboard Shortcuts
Action Windows/Linux macOS Trigger IntelliSense Ctrl+SpaceCmd+SpaceTrigger parameter hints Ctrl+Shift+SpaceCmd+Shift+SpaceAccept suggestion Tab or EnterTab or EnterInsert suggestion Ctrl+EnterCmd+EnterToggle details Ctrl+Space (when open)Cmd+Space (when open)Navigate suggestions Up/Down arrowsUp/Down arrowsSelect suggestion EnterEnter
Configuration
Quick Suggestions
Control when IntelliSense appears automatically:
{
"editor.quickSuggestions" : {
"other" : true ,
"comments" : false ,
"strings" : false
},
"editor.quickSuggestionsDelay" : 10 ,
"editor.suggestOnTriggerCharacters" : true
}
The InternalQuickSuggestionsOptions interface in the source code defines how suggestions are triggered in different contexts.
Suggestion Behavior
Accept on Enter
Accept on Tab
Snippet Suggestions
{
"editor.acceptSuggestionOnEnter" : "on"
}
Filtering and Sorting
Customize how suggestions are filtered and sorted:
{
"editor.suggest.filterGraceful" : true ,
"editor.suggest.localityBonus" : true ,
"editor.suggest.shareSuggestSelections" : true ,
"editor.suggest.showWords" : true ,
"editor.suggest.maxVisibleSuggestions" : 12
}
IntelliSense Types
Method and Function Signatures
View parameter information while typing function calls:
// When you type this function call, IntelliSense shows:
function executeCommand ( commandId : string , args ?: any []) : Promise < void > {
// Implementation
}
// You'll see parameter hints as you type:
executeCommand ( | ) // Shows: (commandId: string, args?: any[])
Hover over variables and expressions to see type information:
const items : CompletionItem [] = [];
// Hovering shows: const items: CompletionItem[]
Documentation
View inline documentation for symbols:
/**
* Add a new edit operation (a replace operation).
* @param range The range to replace (delete). May be empty to represent a simple insert.
* @param text The text to replace with. May be null to represent a simple delete.
*/
addEditOperation ( range : IRange , text : string | null ): void ;
Language-Specific IntelliSense
TypeScript/JavaScript
{
"typescript.suggest.autoImports" : true ,
"typescript.suggest.completeFunctionCalls" : true ,
"typescript.suggest.paths" : true ,
"javascript.suggest.names" : true
}
Python
{
"python.analysis.completeFunctionParens" : true ,
"python.analysis.autoImportCompletions" : true ,
"python.analysis.typeCheckingMode" : "basic"
}
HTML/CSS
{
"html.suggest.html5" : true ,
"css.completion.triggerPropertyValueCompletion" : true ,
"css.completion.completePropertyWithSemicolon" : true
}
Advanced Features
Suggestion Memory
VS Code remembers your suggestion selections to improve future suggestions:
// From source: suggestMemory.ts tracks recently used completions
// This helps prioritize suggestions you use frequently
The suggestion memory is stored per workspace and learns from your coding patterns.
Commit Characters
Certain characters automatically accept the current suggestion:
{
"editor.acceptSuggestionOnCommitCharacter" : true
}
For example, typing . after selecting a suggestion will insert the suggestion and the dot:
console | // Type 'l' to get 'log' suggestion
consolelog | // Press '.' to accept
console . log | // Result
Inline Completions
IntelliSense integrates with inline completion providers like GitHub Copilot:
{
"editor.inlineSuggest.enabled" : true ,
"editor.inlineSuggest.showToolbar" : "onHover"
}
Troubleshooting
If IntelliSense is not working, check that the appropriate language extension is installed and enabled.
Common Issues
No suggestions appearing
Verify editor.quickSuggestions is enabled
Check that the language mode is correctly detected
Ensure language extensions are installed
Slow suggestions
Increase editor.quickSuggestionsDelay
Check for memory-intensive extensions
Consider excluding large directories from search
Incorrect suggestions
Update language extensions
Check type definitions are available
Verify workspace configuration
IntelliSense is optimized for performance with several techniques:
// Lower-case variants are pre-computed for fast fuzzy matching
this . labelLow = this . textLabel . toLowerCase ();
this . sortTextLow = completion . sortText && completion . sortText . toLowerCase ();
this . filterTextLow = completion . filterText && completion . filterText . toLowerCase ();
The completion engine uses cancellation tokens and incremental updates to maintain responsiveness even with large completion lists.