fixed
parent
4bb21ff6d3
commit
74f20fb7b5
9
index.js
9
index.js
|
@ -102,7 +102,7 @@ class AutoPath {
|
|||
inputTxt = getPrefixTxt(inputTxt, pos.character)
|
||||
currDirFixed = join(currDir, inputTxt)
|
||||
|
||||
// console.log('修正后的inputTxt: ', inputTxt)
|
||||
// console.log('修正后的inputTxt: ', inputTxt, currDirFixed)
|
||||
|
||||
if (!inputTxt) {
|
||||
return
|
||||
|
@ -130,6 +130,9 @@ class AutoPath {
|
|||
else if (inputTxt.startsWith('@/') && options.extendWorkspace) {
|
||||
currDirFixed = join(options.extendWorkspace, inputTxt.slice(2))
|
||||
list.push(...ls(currDirFixed))
|
||||
} else if (inputTxt.startsWith('~')) {
|
||||
currDirFixed = inputTxt.replace(/^~/, process.env.HOME)
|
||||
list.push(...ls(currDirFixed))
|
||||
}
|
||||
// 其他的
|
||||
else {
|
||||
|
@ -158,6 +161,8 @@ class AutoPath {
|
|||
function __init__() {
|
||||
let folders = vsc.workspace.workspaceFolders
|
||||
|
||||
// console.log(folders)
|
||||
|
||||
if (folders && folders.length) {
|
||||
options.workspace = folders[0].uri.fsPath
|
||||
}
|
||||
|
@ -174,7 +179,7 @@ function __init__() {
|
|||
// 简单判断是否是vue项目
|
||||
if (isfile(join(options.workspace, 'package.json'))) {
|
||||
let conf = require(join(options.workspace, 'package.json'))
|
||||
if (conf.dependencies.vue) {
|
||||
if (conf.dependencies && conf.dependencies.vue) {
|
||||
let extendWorkspace = join(options.workspace, 'src/')
|
||||
if (isdir(extendWorkspace)) {
|
||||
options.extendWorkspace = extendWorkspace
|
||||
|
|
10
package.json
10
package.json
|
@ -2,15 +2,19 @@
|
|||
"name": "auto-path",
|
||||
"displayName": "auto-path",
|
||||
"description": "🔥 自动提示文件路径, 方便引入项目为的文件",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"publisher": "yutent",
|
||||
"author": "Yutent [@yutent]",
|
||||
"icon": "logo.png",
|
||||
"engines": {
|
||||
"vscode": "^1.49.0"
|
||||
},
|
||||
"categories": ["Other"],
|
||||
"activationEvents": ["*"],
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "out.js",
|
||||
"contributes": {},
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue