|
11 | 11 | */ |
12 | 12 |
|
13 | 13 | import { prepareExecutable } from './javaServerStarter'; |
14 | | -import { LanguageClientOptions, RevealOutputChannelOn, LanguageClient, DidChangeConfigurationNotification, RequestType, TextDocumentPositionParams, ReferencesRequest, NotificationType, MessageType } from 'vscode-languageclient'; |
| 14 | +import { LanguageClientOptions, RevealOutputChannelOn, LanguageClient, DidChangeConfigurationNotification, RequestType, TextDocumentPositionParams, ReferencesRequest, NotificationType, MessageType, ConfigurationRequest, ConfigurationParams } from 'vscode-languageclient'; |
15 | 15 | import * as requirements from './requirements'; |
16 | | -import { languages, IndentAction, workspace, window, commands, ExtensionContext, TextDocument, Position, LanguageConfiguration, Uri, extensions, Command } from "vscode"; |
| 16 | +import { languages, IndentAction, workspace, window, commands, ExtensionContext, TextDocument, Position, LanguageConfiguration, Uri, extensions, Command, TextEditor } from "vscode"; |
17 | 17 | import * as path from 'path'; |
18 | 18 | import * as os from 'os'; |
19 | 19 | import { activateTagClosing, AutoCloseResult } from './tagClosing'; |
@@ -249,6 +249,25 @@ export function activate(context: ExtensionContext) { |
249 | 249 | })); |
250 | 250 | } |
251 | 251 |
|
| 252 | + // Copied from: |
| 253 | + // https://github.com/redhat-developer/vscode-java/pull/1081/files |
| 254 | + languageClient.onRequest(ConfigurationRequest.type, (params: ConfigurationParams) => { |
| 255 | + const result: any[] = []; |
| 256 | + const activeEditor: TextEditor | undefined = window.activeTextEditor; |
| 257 | + for (const item of params.items) { |
| 258 | + if (activeEditor && activeEditor.document.uri.toString() === Uri.parse(item.scopeUri).toString()) { |
| 259 | + if (item.section === "xml.format.insertSpaces") { |
| 260 | + result.push(activeEditor.options.insertSpaces); |
| 261 | + } else if (item.section === "xml.format.tabSize") { |
| 262 | + result.push(activeEditor.options.tabSize); |
| 263 | + } |
| 264 | + } else { |
| 265 | + result.push(workspace.getConfiguration(null, Uri.parse(item.scopeUri)).get(item.section)); |
| 266 | + } |
| 267 | + } |
| 268 | + return result; |
| 269 | + }); |
| 270 | + |
252 | 271 | const api: XMLExtensionApi = { |
253 | 272 | // add API set catalogs to internal memory |
254 | 273 | addXMLCatalogs: (catalogs: string[]) => { |
|
0 commit comments