( view: EditorView, item: CodeActionItem, )
| 341 | } |
| 342 | |
| 343 | export async function executeCodeAction( |
| 344 | view: EditorView, |
| 345 | item: CodeActionItem, |
| 346 | ): Promise<boolean> { |
| 347 | const plugin = LSPPlugin.get(view); |
| 348 | if (!plugin) return false; |
| 349 | |
| 350 | try { |
| 351 | plugin.client.sync(); |
| 352 | |
| 353 | // Handle standalone Command (not CodeAction) |
| 354 | if (isCommand(item.action)) { |
| 355 | return executeCommand(plugin, item.action); |
| 356 | } |
| 357 | |
| 358 | // Handle CodeAction |
| 359 | return applyCodeAction(view, item.action); |
| 360 | } catch (error) { |
| 361 | addLspLogFor(plugin, "error", "Code action execution failed", error); |
| 362 | console.error("[LSP:CodeAction] Failed to execute:", error); |
| 363 | return false; |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | export function supportsCodeActions(view: EditorView): boolean { |
| 368 | const plugin = LSPPlugin.get(view); |
no test coverage detected