Skip to content

Commit 8e437f0

Browse files
committed
feat: implemented provideDeclaration
1 parent dd083d3 commit 8e437f0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/monaco/ls.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,18 @@ export async function setupLs(modelsMap: Ref<Map<string, monaco.editor.ITextMode
520520
}
521521
},
522522
}),
523+
// same with DefinitionProvider
524+
monaco.languages.registerDeclarationProvider(lang, {
525+
provideDeclaration: async (model, position) => {
526+
const codeResult = await ls.findDefinition(
527+
model.uri.toString(),
528+
monaco2code.asPosition(position),
529+
);
530+
if (codeResult) {
531+
return codeResult.map(code2monaco.asLocation);
532+
}
533+
},
534+
}),
523535
);
524536

525537
return ls;

0 commit comments

Comments
 (0)