-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to send a custom "organize imports" command due to missing template variable #2515
Comments
The command name ( I don't use Discord so I don't know what was discussed there, but from your code block it seems like for Ruff you need to provide the document URI and the version as command args. You probably don't want to hardcode those in your key binding; for the URI you can use Still missing here would be a variable for the "version". But I guess it should be easy to add that as a new variable Edit: Actually I see now that the command args is a single entry with an object/dict. So this would be a VersionedTextDocumentIdentifier, and we could add a new varible for that one. |
I've said on Discord that in this case the variables wouldn't work as this is an object and we don't do "deep" processing of dicts like that. But your observation that it's just a versioned document identifier will actually make that work, without having to "deep" process variables. (separate discussion but I'm not sure if chaining would work since we would likely trigger formatting before receiving response for the previous request) |
lsp_organize_imports
command
I made a PR to add it as a new variable, which should probably be sufficient here. For the chaining I think we would need something like a new custom |
I would be cool be be able to sort import with a shortcut
It kinda work like that (see discussion on sublime text discord), but it's buggy
It can be something like
(or even be chained with
lsp_format_document
)That example is for ruff, not sure if it can be generic for all LSP
The text was updated successfully, but these errors were encountered: