Skip to content

Commit 7f974f1

Browse files
AlexXuChenAlexander Chen
authored andcommitted
Added command to bind qute.inlayHint.enabled to editor.inlayHints.enabled
Signed-off-by: AlexXuChen <alchen@redhat.com>
1 parent e9b27ab commit 7f974f1

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/qute/commands/commandConstants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export namespace QuteClientCommandConstants {
3939
* Client command to execute an XML command on XML Language Server side.
4040
*/
4141
export const EXECUTE_WORKSPACE_COMMAND = 'qute.workspace.executeCommand';
42+
43+
/**
44+
* Bind Qute inlay hint setting to editor inlay hint setting.
45+
*/
46+
export const BIND_QUTE_INLAY_HINT = 'bind.qute.inlayHint.enabled';
4247
}
4348

4449
/**

src/qute/commands/registerCommands.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function registerVSCodeQuteCommands(context: ExtensionContext) {
1919
registerJavaDefinitionCommand(context);
2020
registerConfigurationUpdateCommand(context);
2121
registerQuteValidationToggleCommand(context);
22+
registerQuteInlayHintBindToEditorSetting(context);
2223
context.subscriptions.push(
2324
workspace.onDidOpenTextDocument((document) => {
2425
updateQuteLanguageId(context, document, true);
@@ -184,6 +185,20 @@ export function registerConfigurationUpdateCommand(context: ExtensionContext) {
184185
}));
185186
}
186187

188+
export function registerQuteInlayHintBindToEditorSetting(context: ExtensionContext) {
189+
context.subscriptions.push(commands.registerCommand(QuteClientCommandConstants.BIND_QUTE_INLAY_HINT, async () => {
190+
const editorInlayHintSetting = workspace.getConfiguration().get<string>(`editor.inlayHints.enabled`, "on");
191+
if (editorInlayHintSetting === "off") {
192+
const edit = {
193+
value: false,
194+
editType: ConfigurationItemEditType.Add,
195+
section: QuteSettings.QUTE_INLAY_HINT
196+
} as ConfigurationItemEdit;
197+
await commands.executeCommand(QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE, edit);
198+
}
199+
}));
200+
}
201+
187202
/**
188203
* Sets the `editorQuteValidationEnabled` based on `qute.command.validation.template.status` and `qute.validation.enabled`.
189204
*/

src/qute/languageServer/settings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export namespace QuteSettings {
3030
*/
3131
export const QUTE_OVERRIDE_LANGUAGE_ID = 'qute.templates.override.languageId';
3232

33+
/**
34+
* Qute inlay hint setting.
35+
*/
36+
export const QUTE_INLAY_HINT = 'qute.inlayHint.enabled';
37+
3338
export function getQuteTemplatesLanguageMismatch(): QuteTemplateLanguageMismatch {
3439
return workspace.getConfiguration().get<QuteTemplateLanguageMismatch>(QUTE_TEMPLATES_LANGUAGE_MISMATCH);
3540
}

0 commit comments

Comments
 (0)