( plugin: LSPPlugin, command: Command, )
| 124 | } |
| 125 | |
| 126 | async function executeCommand( |
| 127 | plugin: LSPPlugin, |
| 128 | command: Command, |
| 129 | ): Promise<boolean> { |
| 130 | try { |
| 131 | await plugin.client.request< |
| 132 | { command: string; arguments?: unknown[] }, |
| 133 | unknown |
| 134 | >("workspace/executeCommand", { |
| 135 | command: command.command, |
| 136 | arguments: command.arguments, |
| 137 | }); |
| 138 | return true; |
| 139 | } catch (error) { |
| 140 | // -32601 = Method not implemented (expected for some LSP servers) |
| 141 | const lspError = error as { code?: number }; |
| 142 | if (lspError?.code !== -32601) { |
| 143 | addLspLogFor(plugin, "warn", "Code action command execution failed", error); |
| 144 | console.warn("[LSP:CodeAction] Command execution failed:", error); |
| 145 | } |
| 146 | return false; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | interface LspChange { |
| 151 | range: Range; |
no test coverage detected