In visual studio code, using typescript, I get unwanted suggestions when using the intellisense/autocomplete feature.
Examples:
HTMLAllCollection
DOMError
etc...
The reason seems to be that intellisense automatically includes all files in
{vscode dir}/resources/app/extensions/node_modules/typescript/lib
Is there any way to disable intellisense for these?
In the end I want intellisense to only include things that are explicitly related to my project.
In order to control which libraries are loaded in your project and are providing intellisense/autocomplete you need to configure lib
property [array type] of compilerOptions
in your tsconfig.json
file.
If lib
property is not configured, TypeScript will automatically load following libraries:
Example configuration in tsconfig.json
file could look like this:
{
"compilerOptions": {
"target": "es5",
"lib": [
"es2017"
]
}
}
This would load only libraries for ECMAScript 2017 intellisense.
You can read more about compiler options, including lib
here: https://www.typescriptlang.org/docs/handbook/compiler-options.html
Open the Settings editor File > Preferences > Settings (Code > Preferences > Settings
on macOS
snippets :
To disable basic TypeScript snippets you can set editor.snippetSuggestions
to "none"
in your settings file. If you'd like to see snippets, you can specify the order relative to suggestions; at the top ("top")
, at the bottom ("bottom")
, or inlined ordered alphabetically ("inline")
. The default is "inline"
JSDoc support:
To disable JSDoc comment suggestions in TypeScript, set "typescript.suggest.completeJSDocs": false
Auto imports:
You can disable auto imports by setting "typescript.autoImportSuggestions.enabled": false
Formatting:
set "typescript.format.enable"
to false
to disable it.
JSX and auto-closing tags:
Set "typescript.autoClosingTags"
to false
to disable JSX tag closing.
Unused variables and unreachable code:
To disable fading out of unused code, set "editor.showUnused"
to false
. You can also disable fading of unused code only in TypeScriptScript by setting,
"[typescript]": {
"editor.showUnused": false
},
"[typescriptreact]": {
"editor.showUnused": false
},
Code suggestions:
Set "typescript.suggestionActions.enabled
" to false
to disable suggestions.
You can read more on https://code.visualstudio.com/docs/languages/typescript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With