sxei / vscode-plugin-demo

VSCode插件开发全攻略配套demo
1.09k stars 293 forks source link

webview demo do not work #2

Open donaldtone opened 5 years ago

donaldtone commented 5 years ago

the error message shows that '获取工程根路径异常!'

vscode:1.31 windows 7 sp1 professional

perhaps issue: src/util.js if (workspaceFolders.length == 1 && workspaceFolders[0] === vscode.workspace.rootPath) {

"vscode.workspace.rootPath" is deprecated.

snoopylovefiona commented 5 years ago

如果是windows系统,可以在util.js中添加如下代码:

workspaceFolders.forEach(folder => {  // 应对windows系统下的文件路径异常问题  folder = folder.replace(new RegExp("/","g"),'\').substring(1);  if (currentFile.indexOf(folder) === 0) {   projectPath = folder;  } })` 将路径分隔符替换掉就可以了

luochang212 commented 5 years ago

如果是windows系统,可以在util.js中添加如下代码:

workspaceFolders.forEach(folder => {  // 应对windows系统下的文件路径异常问题  folder = folder.replace(new RegExp("/","g"),'\').substring(1);  if (currentFile.indexOf(folder) === 0) {   projectPath = folder;  } })` 将路径分隔符替换掉就可以了

请问应该在文件中的什么位置啊?以及最后一个`符号为什么只有一个,不应该是成对出现的吗?