简体   繁体   English

VSCode中更智能的智能感知-有什么方法摆脱不必要的建议?

[英]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. 我正在为JavaScript使用vscode,但不相关的建议让我很烦。 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. 如果VScode可以“冒泡”我经常使用的东西,或者至少让我可以选择禁用所有这些怪异建议的地方,那将是很好的。 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 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 Types.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. 不必要的建议似乎来自VSCode本身或我不知道的标准库。 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. VS Code中的Intellisense通过使用jsconfig.json文件来告诉编辑器您的项目来启用。 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. 您可以在项目的根目录中添加一个,并使用exclude属性显式排除文件和目录(例如node_modules),也可以使用files属性显式包括文件和目录(例如src /目录)。

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. VS Code还支持在JavaScript项目中使用类型,因此您可以将外部类型定义用于第三方库。

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 您可以在这里阅读更多信息: https : //code.visualstudio.com/Docs/languages/javascript

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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