简体   繁体   中英

Smarter intellisense in VSCode - any way to get rid of unwanted suggestions?

I'm using vscode for javascript and I'm getting annoyed by irrelevant suggestions. Take this simple example for a new function.

Only the first and last suggestions here will ever be relevant for me during this project. It would be great if VScode could "bubble up" things I use frequently to the top or at least give me the option to disable wherever all those weird suggestions are coming from. Is there any way to do this? Would be a huge productivity gain if possible since these common things like creating a function is done so often.

jsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "allowSyntheticDefaultImports": true
    },
    "exclude": [
        "node_modules",
        "bower_components",
        "build",
        "fk/build",
        "target"
    ]
}

I don't see what I can exclude to get rid of the suggestions I got here. They're not coming from angular.

typings.json

{
    "dependencies": {},
    "globalDependencies": {
        "angular": "registry:dt/angular#1.5.0+20160922195358"
    }
}

the unwanted suggestions seems to come from VSCode itself or a standard library I'm not aware of. They do not come from anything in my project or my dependencies from what I can find.

Intellisense in VS Code is enabled by using a jsconfig.json file to tell the editor about your project. You can add one in the root of your project and explicitly exclude files and directories such as node_modules with the exclude property or you can explicitly include them such as a src/ directory with the files property.

For example:

{
    "compilerOptions": {
        "target": "ES6"
    },
    "exclude": [
        "node_modules"
    ]
}

VS Code also supports the use of typings with JavaScript projects so you can use external type definitions for 3rd party libraries.

This should improve the suggestions so the first options are ones that you are more likely to use.

You can read more here: https://code.visualstudio.com/Docs/languages/javascript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM