# path-autocomplete
# 配置路径别名
path-autocomplete.pathMappings 对于定义绝对或相对路径的别名很有用。
"path-autocomplete.pathMappings": {
"/test": "${folder}/src/Actions/test", // alias for /test
"/": "${folder}/src", // the absolute root folder is now /src,
"$root": ${folder}/src // the relative root folder is now /src
// or multiple folders for one mapping
"$root": ["${folder}/p1/src", "${folder}/p2/src"] // the root is now relative to both p1/src and p2/src
}
1
2
3
4
5
6
7
2
3
4
5
6
7
为了能够在编辑器中输入@后提示路径 需要在setting.json中加入如下字段:
"path-autocomplete.pathMappings": {
"@": "${folder}/src/", // alias for /test
}
1
2
3
2
3
# VSCODE go to definition功能识别路径别名
需要配置jsconfig.json/tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
← emmet remote-ssh的使用过程 →