cursorless: Failure on startup when user has no vscode `settings.json`

Talon: v0.2.0-305-g968a (305) Knausj: 3e57e0165257cf07b0e21880d44a91e79cb3ef16 pokey/talon: 0.2.0 pokey/parse-tree: 0.14.0 pokey/cursorless: 0.25.271

2022-02-02 20:55:56 DEBUG User modules loaded at 1.6050s
2022-02-02 20:55:57    IO dired-mode
2022-02-02 20:55:58  INFO (SpeechSystem) Activating speech engine: W2lEngine(fast Conformer b108 (2021-09-15))
2022-02-02 20:55:58    IO Error finding color enablement; falling back to full enablement
2022-02-02 20:55:58    IO Traceback (most recent call last):
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 59, in vscode_get_setting_with_fallback
    return actions.user.vscode_get_setting(key, default_value), False
2022-02-02 20:55:58    IO   File "talon/scripting/actions.py", line 78, in __call__
2022-02-02 20:55:58    IO   File "talon/scripting/types.py", line 383, in call
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 33, in vscode_get_setting
    path: Path = actions.user.vscode_settings_path()
2022-02-02 20:55:58    IO   File "talon/scripting/actions.py", line 78, in __call__
2022-02-02 20:55:58    IO   File "talon/scripting/types.py", line 383, in call
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 89, in vscode_settings_path
    return pick_path(
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 68, in pick_path
    return max(existing_paths, key=lambda path: path.stat().st_mtime)
2022-02-02 20:55:58    IO ValueError: max() arg is an empty sequence
2022-02-02 20:55:58    IO Error finding shape enablement; falling back to full enablement
2022-02-02 20:55:58    IO Traceback (most recent call last):
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 59, in vscode_get_setting_with_fallback
    return actions.user.vscode_get_setting(key, default_value), False
2022-02-02 20:55:58    IO   File "talon/scripting/actions.py", line 78, in __call__
2022-02-02 20:55:58    IO   File "talon/scripting/types.py", line 383, in call
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 33, in vscode_get_setting
    path: Path = actions.user.vscode_settings_path()
2022-02-02 20:55:58    IO   File "talon/scripting/actions.py", line 78, in __call__
2022-02-02 20:55:58    IO   File "talon/scripting/types.py", line 383, in call
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 89, in vscode_settings_path
    return pick_path(
2022-02-02 20:55:58    IO   File "/home/nixos/.talon/user/cursorless-talon/src/marks/vscode_settings.py", line 68, in pick_path
    return max(existing_paths, key=lambda path: path.stat().st_mtime)
2022-02-02 20:55:58    IO ValueError: max() arg is an empty sequence
2022-02-02 20:55:58 ERROR cb error topic="ready" cb=<function on_ready at 0x7fae65c94ca0>
   15:                         lib/python3.9/threading.py:930* # loader thread
   14:                         lib/python3.9/threading.py:973* 
   13:                         lib/python3.9/threading.py:910* 
   12:                            app/resources/loader.py:805| 
   11:                            app/resources/loader.py:755| 
   10:                        talon/scripting/dispatch.py:105| 
    9:                        talon/scripting/dispatch.py:144| 
    8:                        talon/scripting/dispatch.py:135| 
    7: ------------------------------------------------------# loader thread
    6:                            talon/scripting/rctx.py:233| # 'ready' user.cursorless-talon.src.marks.mark:on_ready()
    5:            user/cursorless-talon/src/marks/mark.py:223| vscode_settings_path: Path = actions.u..
    4:                         talon/scripting/actions.py:78 | 
    3:                           talon/scripting/types.py:383| 
    2: user/cursorless-talon/src/marks/vscode_settings.py:89 | return pick_path(
    1: user/cursorless-talon/src/marks/vscode_settings.py:68 | return max(existing_paths, key=lambda path: path.stat().st_mtime)
ValueError: max() arg is an empty sequence

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (17 by maintainers)

Most upvoted comments

Sounds right. In any case, opening the VSCode user settings JSON using the VSCode command and saving it would be the guaranteed correct way to create the settings file.

I think probably the thing to do for now is to show a better error / warning, with an explanation and a link to this issue

I am still getting this warning. In my Linux distribution (Arch) the settings paths are ~/.config/Code - OSS/User/settings.json for the stable and ~/.config/Code - Insiders/User/settings.json for the beta version. I guess this is not covered yet: https://github.com/cursorless-dev/cursorless/blob/main/cursorless-talon/src/marks/vscode_settings.py#L87-L94 . Despite the warning everything is working fine.

I’m still getting:

2022-02-03 17:10:05 WARNING actions: skipped because they have no matching declaration: (user.code_type_dictionary)

Yes, as you discovered, that warning isn’t actually a problem. It’s actually a knausj thing, so you might file that there

Even though I’ve enabled that tag and restarted talon:

$ cat ~/.talon/user/settings.talon 
settings():
    speech.record_all = 1
tag(): user.i3wm
tag(): user.javascript

You should remove that user.javascript tag. Talon will automatically detect when you’re in a javascript file and activate the user.javascript tag for you

I got another error after that one, but I think maybe users installing extensions the expected vscode way might not run into the error below where I don’t have command-server.

For context to understand how I run into it I’m installing vscode with nixos where I list out the extensions and only had talon, parse-tree, and cursorless.

I’m a bit surprised you have the talon extension but not command-server. The talon extension bundles the command-server extension