Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 3aa6a13

Browse files
[jetbrains_projects] Add match path option
Related: #202
1 parent cb23182 commit 3aa6a13

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

jetbrains_projects/__init__.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ def __init__(self):
135135

136136
self.fuzzy = False
137137

138+
self._match_path = self.readConfig('match_path', bool)
139+
if self._match_path is None:
140+
self._match_path = False
141+
138142
plugin_dir = Path(__file__).parent
139143
editors = [
140144
Editor(
@@ -214,6 +218,15 @@ def __init__(self):
214218
]
215219
self.editors = [e for e in editors if e.binary is not None]
216220

221+
@property
222+
def match_path(self):
223+
return self._match_path
224+
225+
@match_path.setter
226+
def match_path(self, value):
227+
self._match_path = value
228+
self.writeConfig('match_path', value)
229+
217230
def supportsFuzzyMatching(self):
218231
return True
219232

@@ -230,8 +243,13 @@ def handleTriggerQuery(self, query: Query):
230243

231244
for editor in self.editors:
232245
for project in editor.list_projects():
233-
if Path(project.path).exists() and m.match(project.name, project.path):
234-
editor_project_pairs.append((editor, project))
246+
if Path(project.path).exists():
247+
if self._match_path:
248+
if m.match(project.name, project.path):
249+
editor_project_pairs.append((editor, project))
250+
else:
251+
if m.match(project.name):
252+
editor_project_pairs.append((editor, project))
235253

236254
# sort by last opened
237255
editor_project_pairs.sort(key=lambda pair: pair[1].last_opened, reverse=True)
@@ -259,6 +277,11 @@ def _make_item(editor: Editor, project: Project) -> Item:
259277

260278
def configWidget(self):
261279
return [
280+
{
281+
'type': 'checkbox',
282+
'property': 'match_path',
283+
'label': 'Match path'
284+
},
262285
{
263286
'type': 'label',
264287
'text': __doc__.strip(),

0 commit comments

Comments
 (0)