Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 56d38c0

Browse files
Fix error when search in project is invoked without any file opened; in this case it will search in the entire home directory
1 parent 599d189 commit 56d38c0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

search_in_project.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,14 @@ def goto_result(self, file_no):
7777
view.add_regions("search_in_project", regions, "entity.name.filename.find-in-files", "circle", sublime.DRAW_OUTLINED)
7878

7979
def search_folders(self):
80-
window_folders = self.window.folders()
81-
file_dirname = [os.path.dirname(self.window.active_view().file_name())]
82-
return window_folders or file_dirname
80+
search_folders = self.window.folders()
81+
if not search_folders:
82+
filename = self.window.active_view().file_name()
83+
if filename:
84+
search_folders = [os.path.dirname(filename)]
85+
else:
86+
search_folders = [os.path.expanduser("~")]
87+
return search_folders
8388

8489
def find_common_path(self, paths):
8590
paths = [path.replace("\"", "") for path in paths]

0 commit comments

Comments
 (0)