Skip to content

Commit

Permalink
feat: implemented provideDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jun 9, 2022
1 parent dd083d3 commit 8e437f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/monaco/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,18 @@ export async function setupLs(modelsMap: Ref<Map<string, monaco.editor.ITextMode
}
},
}),
// same with DefinitionProvider
monaco.languages.registerDeclarationProvider(lang, {
provideDeclaration: async (model, position) => {
const codeResult = await ls.findDefinition(
model.uri.toString(),
monaco2code.asPosition(position),
);
if (codeResult) {
return codeResult.map(code2monaco.asLocation);
}
},
}),
);

return ls;
Expand Down

0 comments on commit 8e437f0

Please sign in to comment.