简体   繁体   English

我如何配置 vscode 以使用我的整个工作区来获取 javsascript 代码建议

[英]how do i configure vscode to use my entire workspace for javsascript code suggestions

i'm not using anything like vue or react or node.我没有使用 vue、react 或 node 之类的东西。 or any other "compiled" javascript library.或任何其他“已编译”的 javascript 库。 i was told that there's some sort of configuration to make it so that vscode will use my entire workspace.有人告诉我,有一些配置可以让 vscode 使用我的整个工作区。 the linked me to some docs that don't seem to include how to do this.将我链接到一些似乎不包括如何执行此操作的文档。

i've created a jsconfig.json but i'm not really sure what exactly i'm supposed to be putting in it.我已经创建了一个 jsconfig.json 但我不确定我应该在里面放什么。 or where to even look for what setting could possibly do this.或者在哪里寻找什么设置可能会做到这一点。 i'm already looking at the vscode docs and they don't我已经在查看 vscode 文档,但他们没有

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6"
    },
    "include": ["js/**/*"]
}

i feel like this is expecting me to be using some sort of compiled javascript library.我觉得这是期望我使用某种编译的 javascript 库。 i'm basically just using jquery and some simple mvc stuff so i don't have to learn a whole new thing.我基本上只是使用 jquery 和一些简单的 mvc 东西,所以我不必学习全新的东西。 i'm able to get good code hinting for php without having to use something like cakephp to make everything work.我能够为 php 获得良好的代码提示,而不必使用 cakephp 之类的东西来使一切正常。

the jsconfig.json needs to be in the project root. jsconfig.json 需要在项目根目录中。 and doesn't need the include.并且不需要包含。

/jsconfig.json /jsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6"
    }
}

add this to your project root to get it to find all the js files in your project for nice code hinting.将此添加到您的项目根目录中,以使其找到项目中的所有 js 文件,以获得良好的代码提示。

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

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