Skip to content

Fix crash on checking for membership - #2857

Merged
rchl merged 3 commits into
mainfrom
3
Apr 8, 2026
Merged

rchl merged 3 commits into
mainfrom
3

Conversation

@rchl

@rchl rchl commented Apr 8, 2026 •

Copy link
Copy Markdown
Member

Reported in Discord:


Recently my command to remove unused imports stop working (Sublime 4203)

    {
        "keys": [
            "super+k",
            "super+i"
        ],
        "command": "lsp_execute",
        "args": {
            "session_name": "LSP-typescript",
            "command_name": "_typescript.organizeImports",
            "command_args": [
                "${file}",
                {
                    "mode": "RemoveUnused"
                }
            ]
        }
    },

I check the console and I saw this error:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python314/sublime_plugin.py", line 1620, in run_
    return self.run(edit, **args)
           ~~~~~~~~^^^^^^^^^^^^^^
  File "/Users/mauroreisvieira/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/execute_command.py", line 31, in run
    params["arguments"] = self._expand_variables(command_args)
                          ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/Users/mauroreisvieira/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/execute_command.py", line 69, in _expand_variables
    if arg in {"$document_id", "${document_id}"}:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use 'dict' as a set element (unhashable type: 'dict')

This ruff's rule seems unsafe. (to be fair it is in preview)
Even when command_args is typed as list[dict[str, str]] it still suggests to use a set.

@rchl
rchl merged commit edf0f43 into main Apr 8, 2026
7 of 8 checks passed
@rchl
rchl deleted the 3 branch April 8, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants