1
1
import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib' ;
2
2
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" ;
4
4
import { Executable , LanguageClient } from 'vscode-languageclient/node' ;
5
5
import { XMLFileAssociation } from '../api/xmlExtensionApi' ;
6
6
import { registerClientServerCommands } from '../commands/registerCommands' ;
@@ -16,7 +16,15 @@ import { getLanguageParticipants } from './languageParticipants';
16
16
import { activateTagClosing , AutoCloseResult } from './tagClosing' ;
17
17
18
18
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
+ } ) ;
20
28
21
29
const ExecuteClientCommandRequest : RequestType < ExecuteCommandParams , any , void > = new RequestType ( 'xml/executeClientCommand' ) ;
22
30
@@ -130,7 +138,7 @@ function getLanguageClientOptions(
130
138
context : ExtensionContext ) : LanguageClientOptions {
131
139
return {
132
140
// Register the server for xml, xsl, dtd, svg
133
- documentSelector : XML_SUPPORTED_LANGUAGE_IDS ,
141
+ documentSelector : XML_SUPPORTED_DOCUMENT_SELECTORS ,
134
142
revealOutputChannelOn : RevealOutputChannelOn . Never ,
135
143
//wrap with key 'settings' so it can be handled same a DidChangeConfiguration
136
144
initializationOptions : {
@@ -195,4 +203,4 @@ function setupActionableNotificationListener(languageClient: LanguageClient): vo
195
203
}
196
204
} ) ;
197
205
} ) ;
198
- }
206
+ }
0 commit comments