Skip to content

Commit

Permalink
feat: 支持workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed Nov 28, 2019
1 parent a7ca497 commit ccc177e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vscode/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 12 additions & 3 deletions vscode/vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ccc177e

Please sign in to comment.