1 /* --------------------------------------------------------------------------------------------
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License. See License.txt in the project root for license information.
4 * ------------------------------------------------------------------------------------------ */
6 Object.defineProperty(exports, "__esModule", { value: true });
7 exports.WorkspaceFoldersFeature = void 0;
8 const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
9 const WorkspaceFoldersFeature = (Base) => {
10 return class extends Base {
11 initialize(capabilities) {
12 let workspaceCapabilities = capabilities.workspace;
13 if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {
14 this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();
15 this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {
16 this._onDidChangeWorkspaceFolders.fire(params.event);
20 getWorkspaceFolders() {
21 return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);
23 get onDidChangeWorkspaceFolders() {
24 if (!this._onDidChangeWorkspaceFolders) {
25 throw new Error('Client doesn\'t support sending workspace folder change events.');
27 if (!this._unregistration) {
28 this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);
30 return this._onDidChangeWorkspaceFolders.event;
34 exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
35 //# sourceMappingURL=workspaceFolders.js.map