@astrojs/language-server 0.23.1 → 0.23.2
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.
package/CHANGELOG.md
CHANGED
|
@@ -13,12 +13,13 @@ declare type DeepPartial<T> = T extends Record<string, unknown> ? {
|
|
|
13
13
|
* For more info on this, see the [internal docs](../../../../../docs/internal/language-server/config.md)
|
|
14
14
|
*/
|
|
15
15
|
export declare class ConfigManager {
|
|
16
|
+
private connection?;
|
|
17
|
+
private hasConfigurationCapability?;
|
|
16
18
|
private globalConfig;
|
|
17
19
|
private documentSettings;
|
|
18
20
|
shouldRefreshTSServices: boolean;
|
|
19
21
|
private isTrusted;
|
|
20
|
-
|
|
21
|
-
constructor(connection?: Connection);
|
|
22
|
+
constructor(connection?: Connection | undefined, hasConfigurationCapability?: boolean | undefined);
|
|
22
23
|
updateConfig(): void;
|
|
23
24
|
removeDocument(scopeUri: string): void;
|
|
24
25
|
getConfig<T>(section: string, scopeUri: string): Promise<T | Record<string, any>>;
|
|
@@ -46,13 +46,14 @@ exports.defaultLSConfig = {
|
|
|
46
46
|
* For more info on this, see the [internal docs](../../../../../docs/internal/language-server/config.md)
|
|
47
47
|
*/
|
|
48
48
|
class ConfigManager {
|
|
49
|
-
constructor(connection) {
|
|
49
|
+
constructor(connection, hasConfigurationCapability) {
|
|
50
|
+
this.connection = connection;
|
|
51
|
+
this.hasConfigurationCapability = hasConfigurationCapability;
|
|
50
52
|
this.globalConfig = { astro: exports.defaultLSConfig };
|
|
51
53
|
this.documentSettings = {};
|
|
52
54
|
// If set to true, the next time we need a TypeScript language service, we'll rebuild it so it gets the new config
|
|
53
55
|
this.shouldRefreshTSServices = false;
|
|
54
56
|
this.isTrusted = true;
|
|
55
|
-
this.connection = connection;
|
|
56
57
|
}
|
|
57
58
|
updateConfig() {
|
|
58
59
|
// Reset all cached document settings
|
|
@@ -63,7 +64,7 @@ class ConfigManager {
|
|
|
63
64
|
delete this.documentSettings[scopeUri];
|
|
64
65
|
}
|
|
65
66
|
async getConfig(section, scopeUri) {
|
|
66
|
-
if (!this.connection) {
|
|
67
|
+
if (!this.connection || !this.hasConfigurationCapability) {
|
|
67
68
|
return (0, utils_1.get)(this.globalConfig, section) ?? {};
|
|
68
69
|
}
|
|
69
70
|
if (!this.documentSettings[scopeUri]) {
|
package/dist/server.js
CHANGED
|
@@ -44,7 +44,7 @@ function startLanguageServer(connection) {
|
|
|
44
44
|
// Create our managers
|
|
45
45
|
const documentManager = new DocumentManager_1.DocumentManager();
|
|
46
46
|
const pluginHost = new PluginHost_1.PluginHost(documentManager);
|
|
47
|
-
|
|
47
|
+
let configManager;
|
|
48
48
|
let typescriptPlugin = undefined;
|
|
49
49
|
let hasConfigurationCapability = false;
|
|
50
50
|
connection.onInitialize((params) => {
|
|
@@ -66,6 +66,7 @@ function startLanguageServer(connection) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
hasConfigurationCapability = !!(params.capabilities.workspace && !!params.capabilities.workspace.configuration);
|
|
69
|
+
configManager = new ConfigManager_1.ConfigManager(connection, hasConfigurationCapability);
|
|
69
70
|
pluginHost.initialize({
|
|
70
71
|
filterIncompleteCompletions: !params.initializationOptions?.dontFilterIncompleteCompletions,
|
|
71
72
|
definitionLinkSupport: !!params.capabilities.textDocument?.definition?.linkSupport,
|