Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/client/xmlClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib';
import { commands, ExtensionContext, extensions, Position, TextDocument, TextEditor, Uri, window, workspace } from 'vscode';
import { Command, ConfigurationParams, ConfigurationRequest, DidChangeConfigurationNotification, DocumentSelector, ExecuteCommandParams, LanguageClientOptions, MessageType, NotificationType, RequestType, RevealOutputChannelOn, State, TextDocumentPositionParams } from "vscode-languageclient";
import { Command, ConfigurationParams, ConfigurationRequest, DidChangeConfigurationNotification, DocumentFilter, DocumentSelector, ExecuteCommandParams, LanguageClientOptions, MessageType, NotificationType, RequestType, RevealOutputChannelOn, State, TextDocumentPositionParams } from "vscode-languageclient";
import { Executable, LanguageClient } from 'vscode-languageclient/node';
import { XMLFileAssociation } from '../api/xmlExtensionApi';
import { registerClientServerCommands } from '../commands/registerCommands';
Expand All @@ -16,7 +16,15 @@ import { getLanguageParticipants } from './languageParticipants';
import { activateTagClosing, AutoCloseResult } from './tagClosing';

const languageParticipants = getLanguageParticipants();
export const XML_SUPPORTED_LANGUAGE_IDS = languageParticipants.documentSelector;

const XML_SUPPORTED_DOCUMENT_SELECTORS = languageParticipants.documentSelector;
export const XML_SUPPORTED_LANGUAGE_IDS: string[] = XML_SUPPORTED_DOCUMENT_SELECTORS
.map(l => {
if (l as DocumentFilter) {
return (l as DocumentFilter).language;
}
return l as string;
});

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

Expand Down Expand Up @@ -130,7 +138,7 @@ function getLanguageClientOptions(
context: ExtensionContext): LanguageClientOptions {
return {
// Register the server for xml, xsl, dtd, svg
documentSelector: XML_SUPPORTED_LANGUAGE_IDS,
documentSelector: XML_SUPPORTED_DOCUMENT_SELECTORS,
revealOutputChannelOn: RevealOutputChannelOn.Never,
//wrap with key 'settings' so it can be handled same a DidChangeConfiguration
initializationOptions: {
Expand Down Expand Up @@ -195,4 +203,4 @@ function setupActionableNotificationListener(languageClient: LanguageClient): vo
}
});
});
}
}
8 changes: 1 addition & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ export async function activate(context: ExtensionContext): Promise<XMLExtensionA
registerClientOnlyCommands(context);

// Update indentation rules for all language which are XML.
XML_SUPPORTED_LANGUAGE_IDS.forEach((l: DocumentSelector) => {
let languageId: string;
if ((l as DocumentFilter).language) {
languageId = (l as DocumentFilter).language;
} else {
languageId = l as string;
}
XML_SUPPORTED_LANGUAGE_IDS.forEach((languageId: string) => {
languages.setLanguageConfiguration(languageId, getIndentationRules());
});

Expand Down