Skip to content

Commit

Permalink
fix: respect codeAction.disabledSupport capability
Browse files Browse the repository at this point in the history
close #1454
  • Loading branch information
johnsoncodehk committed Jun 16, 2022
1 parent 2d9d044 commit 7809a4b
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -145,7 +145,7 @@ export function register(
});
connection.onCodeAction(async handler => {
return worker(handler.textDocument.uri, async vueLs => {
const codeActions = await vueLs.doCodeActions(handler.textDocument.uri, handler.range, handler.context) ?? [];
let codeActions = await vueLs.doCodeActions(handler.textDocument.uri, handler.range, handler.context) ?? [];
for (const codeAction of codeActions) {
if (codeAction.data && typeof codeAction.data === 'object') {
(codeAction.data as any).uri = handler.textDocument.uri;
Expand All @@ -154,6 +154,9 @@ export function register(
codeAction.data = { uri: handler.textDocument.uri };
}
}
if (!params.capabilities.textDocument?.codeAction?.disabledSupport) {
codeActions = codeActions.filter(codeAction => !codeAction.disabled);
}
return codeActions;
});
});
Expand Down

0 comments on commit 7809a4b

Please sign in to comment.