UNPKG

1.58 kBJavaScriptView Raw
1"use strict";
2/* --------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All rights reserved.
4 * Licensed under the MIT License. See License.txt in the project root for license information.
5 * ------------------------------------------------------------------------------------------ */
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.ConfigurationFeature = void 0;
8const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
9const Is = require("./utils/is");
10const ConfigurationFeature = (Base) => {
11 return class extends Base {
12 getConfiguration(arg) {
13 if (!arg) {
14 return this._getConfiguration({});
15 }
16 else if (Is.string(arg)) {
17 return this._getConfiguration({ section: arg });
18 }
19 else {
20 return this._getConfiguration(arg);
21 }
22 }
23 _getConfiguration(arg) {
24 let params = {
25 items: Array.isArray(arg) ? arg : [arg]
26 };
27 return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {
28 if (Array.isArray(result)) {
29 return Array.isArray(arg) ? result : result[0];
30 }
31 else {
32 return Array.isArray(arg) ? [] : null;
33 }
34 });
35 }
36 };
37};
38exports.ConfigurationFeature = ConfigurationFeature;