Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发现一个问题 #6

Open
fengzi1207 opened this issue Jan 17, 2020 · 0 comments
Open

发现一个问题 #6

fengzi1207 opened this issue Jan 17, 2020 · 0 comments

Comments

@fengzi1207
Copy link

就是自动提示那个功能util.js里面第26行代码,
let workspaceFolders = vscode.workspace.workspaceFolders.map(item => item.uri.path)
获取到的Windows下路径不对,Mac下面是一样的
Windows下是这样的
item.uri.path="/d:/AW/awIDE/vscode_plugin"
item.uri.fsPath="d:\AW\awIDE\vscode_plugin"

Mac下是这样的
item.uri.path=/Users/chenghan/work-codes/vscode-plugin/myself-demo
item.uri.fsPath=/Users/chenghan/work-codes/vscode-plugin/myself-demo

Windows下 const currentFile = (document.uri ? document.uri : document).fsPath; 的值是
"d:\AW\awIDE\vscode_plugin\fengzitest\src\test.js"
所以在第37行 currentFile.indexOf(folder)进行匹配的时候 返回-1 正确用法应该是
let workspaceFolders = vscode.workspace.workspaceFolders.map(item => item.uri.path)改为
let workspaceFolders = vscode.workspace.workspaceFolders.map(item => item.uri.fsPath)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant