Skip to content

Commit

Permalink
Added command to bind qute.inlayHint.enabled to editor.inlayHints.ena…
Browse files Browse the repository at this point in the history
…bled

Signed-off-by: AlexXuChen <[email protected]>
  • Loading branch information
AlexXuChen committed Jul 8, 2022
1 parent 32154fd commit 03f445b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/qute/commands/commandConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export namespace QuteClientCommandConstants {
* Client command to execute an XML command on XML Language Server side.
*/
export const EXECUTE_WORKSPACE_COMMAND = 'qute.workspace.executeCommand';

/**
* Bind Qute inlay hint setting to editor inlay hint setting.
*/
export const BIND_QUTE_INLAY_HINT = 'bind.qute.inlayHint.enabled';
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/qute/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ export function registerConfigurationUpdateCommand(context: ExtensionContext) {
}));
}

export function registerQuteInlayHintBindToEditorSetting(context: ExtensionContext) {
context.subscriptions.push(commands.registerCommand(QuteClientCommandConstants.BIND_QUTE_INLAY_HINT, async () => {
const editorInlayHintSetting = workspace.getConfiguration().get<string>(`editor.inlayHints.enabled`, "on");
if (editorInlayHintSetting === "off") {
const edit = {
value: false,
editType: ConfigurationItemEditType.Add,
section: QuteSettings.QUTE_INLAY_HINT
} as ConfigurationItemEdit;
await commands.executeCommand(QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE, edit);
}
}));
}

/**
* Sets the `editorQuteValidationEnabled` based on `qute.command.validation.template.status` and `qute.validation.enabled`.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/qute/languageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export namespace QuteSettings {
*/
export const QUTE_OVERRIDE_LANGUAGE_ID = 'qute.templates.override.languageId';

/**
* Qute inlay hint setting.
*/
export const QUTE_INLAY_HINT = 'qute.inlayHint.enabled';

export function getQuteTemplatesLanguageMismatch(): QuteTemplateLanguageMismatch {
return workspace.getConfiguration().get<QuteTemplateLanguageMismatch>(QUTE_TEMPLATES_LANGUAGE_MISMATCH);
}
Expand Down

0 comments on commit 03f445b

Please sign in to comment.