Skip to content
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

feat: add support for lsp workspace command arguments in prompt #12075

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MrLego8-9
Copy link

@MrLego8-9 MrLego8-9 commented Nov 16, 2024

Treat space-separated values as arguments in the prompt :

:lsp-workspace-command lsp.Command foo bar

Tries to execute command lsp.Command with the arguments [foo, bar] instead of executing lsp.Command foo bar.

This allows users to run lsp commands that require arguments (ex: export* with tinymist).

@the-mikedavis the-mikedavis added A-language-server Area: Language server client A-command Area: Commands labels Nov 18, 2024
Comment on lines +1437 to +1440
let lsp_command_args: Vec<Value> = args[1..]
.iter()
.map(|s| Value::String(s.to_string()))
.collect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're parsing a list of JSON values then we should use the streaming deserializer from serde_json like #12527 does for :toggle-option. The streaming deserializer will take a slightly different syntax for strings - :lsp-workspace-command lsp.Command "foo" "bar" - which would be a breaking change to the syntax added if we merge this as-is.

I'll include this change on that PR since it's not possible to parse the args accurately with the way we parse the command line on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands A-language-server Area: Language server client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support lsp_workspace_commands with arguments
2 participants