@volar/language-server 2.2.0-alpha.0 → 2.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServiceEnvironment } from '@volar/language-service';
|
|
2
|
+
import * as vscode from 'vscode-languageserver';
|
|
3
|
+
export declare function createConfigurationHost(params: vscode.InitializeParams, connection: vscode.Connection): Pick<ServiceEnvironment, 'getConfiguration' | 'onDidChangeConfiguration'> & {
|
|
4
|
+
ready(): void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfigurationHost = void 0;
|
|
4
|
+
const vscode = require("vscode-languageserver");
|
|
5
|
+
function createConfigurationHost(params, connection) {
|
|
6
|
+
const callbacks = new Set();
|
|
7
|
+
const cache = new Map();
|
|
8
|
+
connection.onDidChangeConfiguration(async () => {
|
|
9
|
+
cache.clear();
|
|
10
|
+
for (const cb of callbacks) {
|
|
11
|
+
cb();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
ready() {
|
|
16
|
+
if (params.capabilities.workspace?.didChangeConfiguration?.dynamicRegistration) {
|
|
17
|
+
connection.client.register(vscode.DidChangeConfigurationNotification.type);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
async getConfiguration(section, scopeUri) {
|
|
21
|
+
if (!scopeUri && params.capabilities.workspace?.didChangeConfiguration) {
|
|
22
|
+
if (!cache.has(section)) {
|
|
23
|
+
cache.set(section, await getConfigurationWorker(section, scopeUri));
|
|
24
|
+
}
|
|
25
|
+
return cache.get(section);
|
|
26
|
+
}
|
|
27
|
+
return await getConfigurationWorker(section, scopeUri);
|
|
28
|
+
},
|
|
29
|
+
onDidChangeConfiguration(cb) {
|
|
30
|
+
callbacks.add(cb);
|
|
31
|
+
return {
|
|
32
|
+
dispose() {
|
|
33
|
+
callbacks.delete(cb);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
async function getConfigurationWorker(section, scopeUri) {
|
|
39
|
+
return (await connection.workspace.getConfiguration({ scopeUri, section })) ?? undefined /* replace null to undefined */;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.createConfigurationHost = createConfigurationHost;
|
|
43
|
+
//# sourceMappingURL=configurationHost.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-server",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"directory": "packages/language-server"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.2.0-alpha.
|
|
16
|
-
"@volar/language-service": "2.2.0-alpha.
|
|
17
|
-
"@volar/snapshot-document": "2.2.0-alpha.
|
|
18
|
-
"@volar/typescript": "2.2.0-alpha.
|
|
15
|
+
"@volar/language-core": "2.2.0-alpha.1",
|
|
16
|
+
"@volar/language-service": "2.2.0-alpha.1",
|
|
17
|
+
"@volar/snapshot-document": "2.2.0-alpha.1",
|
|
18
|
+
"@volar/typescript": "2.2.0-alpha.1",
|
|
19
19
|
"@vscode/l10n": "^0.0.16",
|
|
20
20
|
"path-browserify": "^1.0.1",
|
|
21
21
|
"request-light": "^0.7.0",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/path-browserify": "latest"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "e6dcb83ecadcfcc9e22083eea61e1ee817a9d483"
|
|
31
31
|
}
|