Skip to content

Commit 43c3e1b

Browse files
committed
Codelens for referenced grammars
See eclipse-lemminx/lemminx#1092 Signed-off-by: azerr <azerr@redhat.com>
1 parent e903708 commit 43c3e1b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/commands/commandConstants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export namespace ClientCommandConstants {
3737
*/
3838
export const OPEN_SETTINGS = 'xml.open.settings';
3939

40+
/**
41+
* Open settings command
42+
*
43+
* A `settingId: string` parameter can be optionally provided
44+
*/
45+
export const OPEN_URI = 'xml.open.uri';
46+
4047
/**
4148
* Render markdown string to html string
4249
*/

src/commands/registerCommands.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ClientCommandConstants, ServerCommandConstants } from "./commandConstan
1313
export function registerClientOnlyCommands(context: ExtensionContext) {
1414
registerDocsCommands(context);
1515
registerOpenSettingsCommand(context);
16+
registerOpenUriCommand(context);
1617
}
1718

1819
/**
@@ -41,7 +42,8 @@ export async function registerClientServerCommands(context: ExtensionContext, la
4142
};
4243
if (token) {
4344
return languageClient.sendRequest(ExecuteCommandRequest.type, params, token);
44-
} else {
45+
}
46+
else {
4547
return languageClient.sendRequest(ExecuteCommandRequest.type, params);
4648
}
4749
}));
@@ -81,6 +83,17 @@ function registerOpenSettingsCommand(context: ExtensionContext) {
8183
}));
8284
}
8385

86+
/**
87+
* Registers a command that opens the settings page to a given setting
88+
*
89+
* @param context the extension context
90+
*/
91+
function registerOpenUriCommand(context: ExtensionContext) {
92+
context.subscriptions.push(commands.registerCommand(ClientCommandConstants.OPEN_URI, async (uri?: string) => {
93+
commands.executeCommand('vscode.open', Uri.parse(uri));
94+
}));
95+
}
96+
8497
/**
8598
* Register commands used for code lens "references"
8699
*

0 commit comments

Comments
 (0)