diff --git a/playground/src/App.tsx b/playground/src/App.tsx index 1851d9ee8..da8b27b42 100644 --- a/playground/src/App.tsx +++ b/playground/src/App.tsx @@ -14,6 +14,7 @@ import { decompressFromEncodedURIComponent, } from "lz-string" import { + ideCodeActions, provideInlayHints, provideHover, provideDefinition, @@ -400,8 +401,11 @@ function registerMonacoProvidersOnce() { const codeActionProvider = monaco.languages.registerCodeActionProvider( "pgsql", { - provideCodeActions: (model, _range, context) => { - const actions: monaco.languages.CodeAction[] = [] + provideCodeActions: (model, range, context) => { + const actions: monaco.languages.CodeAction[] = ideCodeActions( + model, + range, + ) for (const marker of context.markers) { if (marker.source === "squawk") { const key = createMarkerKey(marker) diff --git a/playground/src/providers.tsx b/playground/src/providers.tsx index d638a5738..32d852262 100644 --- a/playground/src/providers.tsx +++ b/playground/src/providers.tsx @@ -97,10 +97,10 @@ function convertSymbolKind(kind: string): monaco.languages.SymbolKind { } } -export async function provideCodeActions( +export function ideCodeActions( model: monaco.editor.ITextModel, - position: monaco.Position, -): Promise { + range: monaco.IRange, +): monaco.languages.CodeAction[] { const content = model.getValue() const version = model.getVersionId() if (!content) return [] @@ -109,8 +109,8 @@ export async function provideCodeActions( const actions = code_actions( content, version, - position.lineNumber - 1, - position.column - 1, + range.startLineNumber - 1, + range.startColumn - 1, ) if (!actions) return [] @@ -135,7 +135,7 @@ export async function provideCodeActions( }, })) } catch (e) { - console.error("Error in provideCodeActions:", e) + console.error("Error in ideCodeActions:", e) return [] } }