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