diff --git a/vscode/plugin.json b/vscode/plugin.json index 9ec36ea..86e4f3d 100644 --- a/vscode/plugin.json +++ b/vscode/plugin.json @@ -2,7 +2,7 @@ "name": "830ef6d0", "pluginName": "vscode", "description": "快速搜索vscode历史项目并且在vscode中打开", - "version": "1.3.4", + "version": "1.3.5", "preload": "preload.js", "author": "莫回首", "homepage": "https://github.com/mohuishou/utools", diff --git a/vscode/vscode.js b/vscode/vscode.js index 7b090e2..777d009 100644 --- a/vscode/vscode.js +++ b/vscode/vscode.js @@ -19,18 +19,27 @@ function search (keyword) { for (let i = 0; i < keywords.length; i++) { const word = keywords[i]; files = files.filter((file, index, arr) => { + // 适配工作区 + if (typeof (file) === 'object' && "configURIPath" in file) { + file = file.configURIPath + } return ( + // 确保不报错 + typeof (file) === "string" && // 去重 - arr.indexOf(file) == index && + (file.includes("workspace") || arr.indexOf(file) == index) && // 排除远程开发 - file.indexOf("vscode-remote") != 0 && + !file.includes("vscode-remote") && // 搜索 - file.toLowerCase().indexOf(word.trim().toLowerCase()) > -1 + file.toLowerCase().includes(word.trim().toLowerCase()) ); }); } return files.map(file => { + if (typeof (file) === 'object' && "configURIPath" in file) { + file = file.configURIPath + } // 格式化返回数据 file = decodeURIComponent(file); return {