Skip to content

发现一个问题 #6

@fengzi1207

Description

@fengzi1207

就是自动提示那个功能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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions