Skip to content

Commit 49f7084

Browse files
Show better exception message when vscode settings json is not found (#2655)
Today you get a `ValueError: max() arg is an empty sequence` message that is quite confusing. ## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet
1 parent 2306d1b commit 49f7084

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cursorless-talon/src/apps/vscode_settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def vscode_get_setting_with_fallback(
6767

6868
def pick_path(paths: list[Path]) -> Path:
6969
existing_paths = [path for path in paths if path.exists()]
70+
if not existing_paths:
71+
paths_str = ", ".join(str(path) for path in paths)
72+
raise FileNotFoundError(
73+
f"Couldn't find VSCode's settings JSON. Tried these paths: {paths_str}"
74+
)
7075
return max(existing_paths, key=lambda path: path.stat().st_mtime)
7176

7277

0 commit comments

Comments
 (0)