Skip to content

Commit e5baa16

Browse files
angelozerrdatho7561
authored andcommitted
"Surround" Commands are not shown in the Command Palette
Fixes #923 Signed-off-by: azerr <[email protected]>
1 parent ef5c7de commit e5baa16

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/client/xmlClient.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib';
22
import { commands, ExtensionContext, extensions, Position, TextDocument, TextEditor, Uri, window, workspace } from 'vscode';
3-
import { Command, ConfigurationParams, ConfigurationRequest, DidChangeConfigurationNotification, DocumentSelector, ExecuteCommandParams, LanguageClientOptions, MessageType, NotificationType, RequestType, RevealOutputChannelOn, State, TextDocumentPositionParams } from "vscode-languageclient";
3+
import { Command, ConfigurationParams, ConfigurationRequest, DidChangeConfigurationNotification, DocumentFilter, DocumentSelector, ExecuteCommandParams, LanguageClientOptions, MessageType, NotificationType, RequestType, RevealOutputChannelOn, State, TextDocumentPositionParams } from "vscode-languageclient";
44
import { Executable, LanguageClient } from 'vscode-languageclient/node';
55
import { XMLFileAssociation } from '../api/xmlExtensionApi';
66
import { registerClientServerCommands } from '../commands/registerCommands';
@@ -16,7 +16,15 @@ import { getLanguageParticipants } from './languageParticipants';
1616
import { activateTagClosing, AutoCloseResult } from './tagClosing';
1717

1818
const languageParticipants = getLanguageParticipants();
19-
export const XML_SUPPORTED_LANGUAGE_IDS = languageParticipants.documentSelector;
19+
20+
const XML_SUPPORTED_DOCUMENT_SELECTORS = languageParticipants.documentSelector;
21+
export const XML_SUPPORTED_LANGUAGE_IDS: string[] = XML_SUPPORTED_DOCUMENT_SELECTORS
22+
.map(l => {
23+
if (l as DocumentFilter) {
24+
return (l as DocumentFilter).language;
25+
}
26+
return l as string;
27+
});
2028

2129
const ExecuteClientCommandRequest: RequestType<ExecuteCommandParams, any, void> = new RequestType('xml/executeClientCommand');
2230

@@ -130,7 +138,7 @@ function getLanguageClientOptions(
130138
context: ExtensionContext): LanguageClientOptions {
131139
return {
132140
// Register the server for xml, xsl, dtd, svg
133-
documentSelector: XML_SUPPORTED_LANGUAGE_IDS,
141+
documentSelector: XML_SUPPORTED_DOCUMENT_SELECTORS,
134142
revealOutputChannelOn: RevealOutputChannelOn.Never,
135143
//wrap with key 'settings' so it can be handled same a DidChangeConfiguration
136144
initializationOptions: {
@@ -195,4 +203,4 @@ function setupActionableNotificationListener(languageClient: LanguageClient): vo
195203
}
196204
});
197205
});
198-
}
206+
}

src/extension.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ export async function activate(context: ExtensionContext): Promise<XMLExtensionA
3535
registerClientOnlyCommands(context);
3636

3737
// Update indentation rules for all language which are XML.
38-
XML_SUPPORTED_LANGUAGE_IDS.forEach((l: DocumentSelector) => {
39-
let languageId: string;
40-
if ((l as DocumentFilter).language) {
41-
languageId = (l as DocumentFilter).language;
42-
} else {
43-
languageId = l as string;
44-
}
38+
XML_SUPPORTED_LANGUAGE_IDS.forEach((languageId: string) => {
4539
languages.setLanguageConfiguration(languageId, getIndentationRules());
4640
});
4741

0 commit comments

Comments
 (0)