Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
decompressFromEncodedURIComponent,
} from "lz-string"
import {
ideCodeActions,
provideInlayHints,
provideHover,
provideDefinition,
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions playground/src/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<monaco.languages.CodeAction[]> {
range: monaco.IRange,
): monaco.languages.CodeAction[] {
const content = model.getValue()
const version = model.getVersionId()
if (!content) return []
Expand All @@ -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 []
Expand All @@ -135,7 +135,7 @@ export async function provideCodeActions(
},
}))
} catch (e) {
console.error("Error in provideCodeActions:", e)
console.error("Error in ideCodeActions:", e)
return []
}
}
Expand Down
Loading