diff --git a/src/lang/ar-ye.json b/src/lang/ar-ye.json index 0b940478e..f7fe9498f 100644 --- a/src/lang/ar-ye.json +++ b/src/lang/ar-ye.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/be-by.json b/src/lang/be-by.json index 7ba2ecb60..73ba8030a 100644 --- a/src/lang/be-by.json +++ b/src/lang/be-by.json @@ -427,5 +427,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/bn-bd.json b/src/lang/bn-bd.json index c822d8537..08c56b2a6 100644 --- a/src/lang/bn-bd.json +++ b/src/lang/bn-bd.json @@ -426,5 +426,6 @@ "reviews": "রিভিউ", "overview": "সংক্ষিপ্ত বিবরণ", "contributors": "অবদানকারী", - "quicktools:hyphen": "হাইফেন যুক্ত করুন" + "quicktools:hyphen": "হাইফেন যুক্ত করুন", + "search exclude": "Search Exclude" } diff --git a/src/lang/cs-cz.json b/src/lang/cs-cz.json index 4f5889ada..593dd3520 100644 --- a/src/lang/cs-cz.json +++ b/src/lang/cs-cz.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/de-de.json b/src/lang/de-de.json index a0c12babb..bc5e7a47c 100644 --- a/src/lang/de-de.json +++ b/src/lang/de-de.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 16c721ba6..db50afab1 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/es-sv.json b/src/lang/es-sv.json index 5e4c2c8fd..a9d52a60e 100644 --- a/src/lang/es-sv.json +++ b/src/lang/es-sv.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/fr-fr.json b/src/lang/fr-fr.json index 3023da60a..c6a634ce2 100644 --- a/src/lang/fr-fr.json +++ b/src/lang/fr-fr.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/he-il.json b/src/lang/he-il.json index 143397186..78d2855d6 100644 --- a/src/lang/he-il.json +++ b/src/lang/he-il.json @@ -427,5 +427,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/hi-in.json b/src/lang/hi-in.json index 38d3a9c10..439326928 100644 --- a/src/lang/hi-in.json +++ b/src/lang/hi-in.json @@ -427,5 +427,6 @@ "reviews": "समीक्षाएँ", "overview": "ओवरव्यू", "contributors": "सहयोगी", - "quicktools:hyphen": "हाइफ़न प्रतीक डालें" + "quicktools:hyphen": "हाइफ़न प्रतीक डालें", + "search exclude": "Search Exclude" } diff --git a/src/lang/hu-hu.json b/src/lang/hu-hu.json index ba680aa02..c01c15ae2 100644 --- a/src/lang/hu-hu.json +++ b/src/lang/hu-hu.json @@ -426,5 +426,6 @@ "reviews": "áttekintések", "overview": "Áttekintés", "contributors": "Közreműködők", - "quicktools:hyphen": "Kötőjel beszúrása" + "quicktools:hyphen": "Kötőjel beszúrása", + "search exclude": "Search Exclude" } diff --git a/src/lang/id-id.json b/src/lang/id-id.json index d456a0da9..4c0c7d34e 100644 --- a/src/lang/id-id.json +++ b/src/lang/id-id.json @@ -427,5 +427,6 @@ "reviews": "Ulasan", "overview": "Ikhtisar", "contributors": "Kontributor", - "quicktools:hyphen": "Masukkan simbol tanda hubung" + "quicktools:hyphen": "Masukkan simbol tanda hubung", + "search exclude": "Search Exclude" } diff --git a/src/lang/ir-fa.json b/src/lang/ir-fa.json index b7e0da370..bab06fba1 100644 --- a/src/lang/ir-fa.json +++ b/src/lang/ir-fa.json @@ -427,5 +427,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/it-it.json b/src/lang/it-it.json index bc28f7de9..5f7a34749 100644 --- a/src/lang/it-it.json +++ b/src/lang/it-it.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/ja-jp.json b/src/lang/ja-jp.json index 41f3b285e..3ce167ed9 100644 --- a/src/lang/ja-jp.json +++ b/src/lang/ja-jp.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/ko-kr.json b/src/lang/ko-kr.json index 8a94d6b9f..d05d7dc42 100644 --- a/src/lang/ko-kr.json +++ b/src/lang/ko-kr.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/ml-in.json b/src/lang/ml-in.json index 8c224ccc6..b5d46961b 100644 --- a/src/lang/ml-in.json +++ b/src/lang/ml-in.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/mm-unicode.json b/src/lang/mm-unicode.json index 34cfd4eb5..c5af13f3f 100644 --- a/src/lang/mm-unicode.json +++ b/src/lang/mm-unicode.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/mm-zawgyi.json b/src/lang/mm-zawgyi.json index e58d49505..11701c841 100644 --- a/src/lang/mm-zawgyi.json +++ b/src/lang/mm-zawgyi.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/pl-pl.json b/src/lang/pl-pl.json index f518264b4..4bf71ac6b 100644 --- a/src/lang/pl-pl.json +++ b/src/lang/pl-pl.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/pt-br.json b/src/lang/pt-br.json index 9a104dc69..a7397c513 100644 --- a/src/lang/pt-br.json +++ b/src/lang/pt-br.json @@ -426,5 +426,6 @@ "reviews": "Avaliações", "overview": "Visão Geral", "contributors": "Contribuidores", - "quicktools:hyphen": "Inserir símbolo de hífen" + "quicktools:hyphen": "Inserir símbolo de hífen", + "search exclude": "Search Exclude" } diff --git a/src/lang/pu-in.json b/src/lang/pu-in.json index b86d9c06d..788e69274 100644 --- a/src/lang/pu-in.json +++ b/src/lang/pu-in.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/ru-ru.json b/src/lang/ru-ru.json index d129691bb..7c377f2ee 100644 --- a/src/lang/ru-ru.json +++ b/src/lang/ru-ru.json @@ -426,5 +426,6 @@ "reviews": "Отзывы", "overview": "Обзор", "contributors": "Авторы", - "quicktools:hyphen": "Вставить символ дефиса" + "quicktools:hyphen": "Вставить символ дефиса", + "search exclude": "Search Exclude" } diff --git a/src/lang/tl-ph.json b/src/lang/tl-ph.json index 5eedc59c7..4accc07b6 100644 --- a/src/lang/tl-ph.json +++ b/src/lang/tl-ph.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/tr-tr.json b/src/lang/tr-tr.json index 1f24de662..1494cd3a4 100644 --- a/src/lang/tr-tr.json +++ b/src/lang/tr-tr.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/uk-ua.json b/src/lang/uk-ua.json index 8e50b5203..73fc92308 100644 --- a/src/lang/uk-ua.json +++ b/src/lang/uk-ua.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/uz-uz.json b/src/lang/uz-uz.json index b5566c4df..08956c33a 100644 --- a/src/lang/uz-uz.json +++ b/src/lang/uz-uz.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/vi-vn.json b/src/lang/vi-vn.json index 885d522ce..5bcf83f9d 100644 --- a/src/lang/vi-vn.json +++ b/src/lang/vi-vn.json @@ -427,5 +427,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index 59e078be4..fc1b67c1c 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/zh-hant.json b/src/lang/zh-hant.json index 09c04cd49..aca888ee8 100644 --- a/src/lang/zh-hant.json +++ b/src/lang/zh-hant.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index e90f60b48..92d355714 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -426,5 +426,6 @@ "reviews": "reviews", "overview": "Overview", "contributors": "Contributors", - "quicktools:hyphen": "Insert hyphen symbol" + "quicktools:hyphen": "Insert hyphen symbol", + "search exclude": "Search Exclude" } diff --git a/src/lib/fileList.js b/src/lib/fileList.js index 4d390e1ed..781b283b5 100644 --- a/src/lib/fileList.js +++ b/src/lib/fileList.js @@ -139,6 +139,12 @@ files.off = function (event, callback) { events[event] = events[event].filter((cb) => cb !== callback); }; +/** + * Are we doing a search? + * @type {boolean} + */ +files.search; + /** * Get directory tree * @param {Tree[]} treeList list of tree @@ -300,6 +306,15 @@ async function createChildTree(parent, item, root) { const file = await Tree.create(url, name, isDirectory); if (!root.isConnected) return; + const ignores = files.search + ? [...settings.value.excludeFiles, ...settings.value.searchExclude] + : settings.value.excludeFiles; + + const ignore = !!ignores.find((folder) => + minimatch(file.path, folder, { matchBase: true }), + ); + if (ignore) return; + const existingTree = getTree(Object.values(filesTree), file.url); if (existingTree) { @@ -310,11 +325,6 @@ async function createChildTree(parent, item, root) { parent.children.push(file); if (isDirectory) { - const ignore = !!settings.value.excludeFolders.find((folder) => - minimatch(Url.join(file.path, ""), folder, { matchBase: true }), - ); - if (ignore) return; - getAllFiles(file, root); return; } diff --git a/src/lib/settings.js b/src/lib/settings.js index 21ef2be55..c99accc19 100644 --- a/src/lib/settings.js +++ b/src/lib/settings.js @@ -40,45 +40,47 @@ class Settings { showHiddenFiles: false, sortByName: true, }; - #excludeFolders = [ - "**/node_modules/**", - "**/bower_components/**", - "**/jspm_packages/**", - "**/.npm/**", - "**/flow-typed/**", - "**/vendor/**", - "**/composer/**", - "**/venv/**", - "**/.virtualenv/**", - "**/__pycache__/**", - "**/.pytest_cache/**", - "**/.eggs/**", - "**/*.egg-info/**", - "**/.git/**", - "**/.svn/**", - "**/.hg/**", - "**/.vscode/**", - "**/.idea/**", - "**/.vs/**", - "**/.project/**", - "**/.settings/**", - "**/.classpath/**", - "**/dist/**", - "**/build/**", - "**/out/**", - "**/target/**", - "**/bin/**", - "**/obj/**", - "**/coverage/**", - "**/.nyc_output/**", - "**/htmlcov/**", - "**/temp/**", - "**/tmp/**", - "**/.cache/**", - "**/logs/**", - "**/.sass-cache/**", - "**/.DS_Store/**", - "**/Thumbs.db/**", + #excludeFiles = [ + "**/.git", + "**/.svn", + "**/.hg", + "**/.DS_Store", + "**/Thumbs.db", + ]; + #searchExclude = [ + "**/node_modules", + "**/bower_components", + "**/jspm_packages", + "**/.npm", + "**/flow-typed", + "**/vendor", + "**/composer", + "**/venv", + "**/.virtualenv", + "**/__pycache__", + "**/.pytest_cache", + "**/.eggs", + "**/*.egg-info", + "**/.vscode", + "**/.idea", + "**/.vs", + "**/.project", + "**/.settings", + "**/.classpath", + "**/dist", + "**/build", + "**/out", + "**/target", + "**/bin", + "**/obj", + "**/coverage", + "**/.nyc_output", + "**/htmlcov", + "**/temp", + "**/tmp", + "**/.cache", + "**/logs", + "**/.sass-cache", ]; #IS_TABLET = innerWidth > 768; @@ -167,7 +169,9 @@ class Settings { useTextareaForIME: false, touchMoveThreshold: Math.round((1 / devicePixelRatio) * 10) / 20, quicktoolsItems: [...Array(this.#QUICKTOOLS_SIZE).keys()], - excludeFolders: this.#excludeFolders, + excludeFiles: this.#excludeFiles, + searchExclude: this.#searchExclude, + excludeGitIgnore: false, defaultFileEncoding: "UTF-8", inlineAutoCompletion: true, colorPreview: true, @@ -265,6 +269,7 @@ class Settings { if (settings) { Object.keys(settings).forEach((key) => { + key = this.#patchKey(key); if (key in this.value) this.value[key] = settings[key]; }); } @@ -333,7 +338,7 @@ class Settings { * @returns */ get(key) { - return this.value[key]; + return this.value[this.#patchKey(key)]; } /** @@ -370,6 +375,14 @@ class Settings { } } + #patchKey(key) { + if (key === "excludeFolders") { + return "excludeFiles"; + } else { + return key; + } + } + async applyAnimationSetting() { let value = this.value.animation; if (value === "system") { diff --git a/src/settings/appSettings.js b/src/settings/appSettings.js index 28a2da6e7..4209039df 100644 --- a/src/settings/appSettings.js +++ b/src/settings/appSettings.js @@ -161,9 +161,9 @@ export default function otherSettings() { checkbox: values.showSideButtons, }, { - key: "excludeFolders", + key: "excludeFiles", text: strings["exclude files"], - value: values.excludeFolders.join("\n"), + value: values.excludeFiles.join("\n"), prompt: strings["exclude files"], promptType: "textarea", promptOptions: { @@ -174,6 +174,20 @@ export default function otherSettings() { }, }, }, + { + key: "searchExclude", + text: strings["search exclude"], + value: values.searchExclude.join("\n"), + prompt: strings["search exclude"], + promptType: "textarea", + promptOptions: { + test(value) { + return value.split("\n").every((item) => { + return item.trim().length > 0; + }); + }, + }, + }, { key: "defaultFileEncoding", text: strings["default file encoding"], @@ -281,6 +295,13 @@ export default function otherSettings() { .filter((item) => item.length > 0); break; + case "explorerExludeFiles": + value = value + .split("\n") + .map((item) => item.trim()) + .filter((item) => item.length > 0); + break; + default: break; } diff --git a/src/sidebarApps/searchInFiles/index.js b/src/sidebarApps/searchInFiles/index.js index 5fc682911..8ebf68bc8 100644 --- a/src/sidebarApps/searchInFiles/index.js +++ b/src/sidebarApps/searchInFiles/index.js @@ -422,7 +422,9 @@ async function searchAll() { addEvents(); + files.search = true; const allFiles = files(); + files.search = false; editorManager.files.forEach((file) => { const exists = allFiles.find((f) => f.url === file.uri); if (exists) return;