Skip to content

Commit ee475f9

Browse files
author
Sascha Goldhofer
committed
Add optional fast_query
1 parent 1d98d04 commit ee475f9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

common/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"trigger_action": ["auto_complete", "insert_path"],
99
"insert_action": ["commit_completion", "insert_best_completion"],
1010
"trigger_statements": ["prefix", "tagName", "style"],
11+
"fast_query": False,
1112

1213
"base_directory": False,
1314
"project_directory": False,

project/FileCache.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from FuzzyFilePath.common.verbose import verbose
66
from FuzzyFilePath.common.verbose import log
77
import FuzzyFilePath.common.path as Path
8+
import FuzzyFilePath.common.settings as settings
89
from FuzzyFilePath.project.FileCacheWorker import FileCacheWorker
910

1011
ID = "search"
@@ -61,11 +62,14 @@ def search_completions(self, needle, project_folder, valid_extensions, base_path
6162
needle = re.escape(needle);
6263

6364
# build search expression
64-
regex = ".*"
65-
for i in needle:
66-
regex += i + ".*"
65+
if settings.get("fast_query"):
66+
regex = ".*" + re.sub("\\\/", ".*\\\/.*", needle) + ".*"
67+
else:
68+
regex = ".*"
69+
for i in needle:
70+
regex += i + ".*"
6771

68-
verbose(ID, "scan", len(project_files), "files for", regex, valid_extensions);
72+
verbose(ID, "scan", len(project_files), "files for", regex, "(" + needle + ")", valid_extensions);
6973

7074
# get matching files
7175
result = []

0 commit comments

Comments
 (0)