Javascript vscode";智能感知“;及;转到“定义”;对于非js/ts文件
在前端开发中,我们通常不仅导入javasctipt中的javascript/typescript文件。我们使用别名和相对路径导入这样的文件 例如:Javascript vscode";智能感知“;及;转到“定义”;对于非js/ts文件,javascript,visual-studio-code,frontend,vscode-settings,Javascript,Visual Studio Code,Frontend,Vscode Settings,在前端开发中,我们通常不仅导入javasctipt中的javascript/typescript文件。我们使用别名和相对路径导入这样的文件 例如: import brandsQuery from '~/graphql/queries/brands.gql'; import Button from '~/components/common/button/index.vue'; import Component from './list/index.vue'; 默认情况下,当我们导入此类文件时,V
import brandsQuery from '~/graphql/queries/brands.gql';
import Button from '~/components/common/button/index.vue';
import Component from './list/index.vue';
默认情况下,当我们导入此类文件时,VS代码不支持not js/ts扩展名-此类文件没有“Intellisense”和“Go to DefinitionOn”
我尝试过这样的扩展:而且
VS代码设置以支持别名:
"path-intellisense.mappings": {
"~/": "${workspaceFolder}",
},
或
使用这些扩展,我们在编写导入字符串时可以自动完成。对于相对路径,“转到定义”也有效
但“转到定义”不适用于使用alias导入的非js ts文件
您知道如何将“智能感知”和“转到定义”同时用于我的项目中所需的所有扩展吗?请参见
许多现代JS捆绑包和框架使用import
语句
导入图像和样式表等资产。我们现在支持
使用导航这些导入,转到定义:
这可能在使用ctrl/cmd时最有用
单击以浏览代码
看看下周到期的v1.57版。
"path-autocomplete.pathMappings": {
"~/": "${folder}/",
}