Skip to content

register available commands in ExecuteCommandProvider#193

Open
MrTomatePNG wants to merge 3 commits intosqls-server:masterfrom
MrTomatePNG:resgister-commands
Open

register available commands in ExecuteCommandProvider#193
MrTomatePNG wants to merge 3 commits intosqls-server:masterfrom
MrTomatePNG:resgister-commands

Conversation

@MrTomatePNG
Copy link
Copy Markdown

Hi there! I've been using this project and I like the premise.

I am currently developing a small extension to integrate this LSP into the Zed editor ([repo here](https://github.com/MrTomatePNG/zed-sqls-extension)). However, I ran into an obstacle: Zed is quite strict about LSP capabilities. During startup, it requires the server to register available commands in advance. If they are not registered during the initialization phase, Zed's UI simply ignores them, even if the LSP reports them as available later.

I initially built a small proxy to intercept and inject these capabilities, but since the fix is straightforward, I believe it's better to implement it directly here. This PR adds the explicit command registration to the ExecuteCommandProvider:

ExecuteCommandProvider: &lsp.ExecuteCommandOptions{
    Commands: []string{
        CommandExecuteQuery,
        CommandShowDatabases,
        CommandShowSchemas,
        CommandShowConnections,
        CommandSwitchDatabase,
        CommandSwitchConnection,
        CommandShowTables,
    },
},

Since this change only clarifies the server's capabilities during the initial handshake, it is non-breaking and should not affect other editors like Vim, Emacs, or Sublime Text.

I look forward to your feedback, I have other ideas with LSP protocol
image

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.

1 participant