MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / resolveCodeAction

Function resolveCodeAction

src/cm/lsp/codeActions.ts:95–124  ·  view source on GitHub ↗
(
	plugin: LSPPlugin,
	action: CodeAction,
)

Source from the content-addressed store, hash-verified

93}
94
95async function resolveCodeAction(
96 plugin: LSPPlugin,
97 action: CodeAction,
98): Promise<CodeAction> {
99 // If action already has an edit, no need to resolve
100 if (action.edit) return action;
101
102 const capabilities = plugin.client.serverCapabilities;
103 const provider = capabilities?.codeActionProvider;
104 const supportsResolve =
105 typeof provider === "object" &&
106 provider !== null &&
107 "resolveProvider" in provider &&
108 provider.resolveProvider === true;
109
110 if (!supportsResolve) return action;
111
112 // Resolve to get the edit property (lazy computation per LSP 3.16+)
113 try {
114 const resolved = await plugin.client.request<CodeAction, CodeAction>(
115 "codeAction/resolve",
116 action,
117 );
118 return resolved ?? action;
119 } catch (error) {
120 addLspLogFor(plugin, "warn", "Code action resolve failed", error);
121 console.warn("[LSP:CodeAction] Failed to resolve:", error);
122 return action;
123 }
124}
125
126async function executeCommand(
127 plugin: LSPPlugin,

Callers 1

applyCodeActionFunction · 0.85

Calls 1

addLspLogForFunction · 0.90

Tested by

no test coverage detected