@astrojs/language-server 0.9.2 → 0.12.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/browserServer.js +3 -0
  3. package/bin/nodeServer.js +3 -0
  4. package/dist/browser.d.ts +1 -0
  5. package/dist/browser.js +8 -0
  6. package/dist/check.js +2 -5
  7. package/dist/core/DiagnosticsManager.d.ts +3 -3
  8. package/dist/core/DiagnosticsManager.js +2 -2
  9. package/dist/core/config/ConfigManager.d.ts +19 -164
  10. package/dist/core/config/ConfigManager.js +62 -101
  11. package/dist/core/config/index.d.ts +1 -0
  12. package/dist/core/config/index.js +6 -1
  13. package/dist/core/config/interfaces.d.ts +123 -0
  14. package/dist/core/config/interfaces.js +2 -0
  15. package/dist/core/documents/AstroDocument.d.ts +18 -0
  16. package/dist/core/documents/AstroDocument.js +37 -0
  17. package/dist/core/documents/DocumentBase.d.ts +10 -2
  18. package/dist/core/documents/DocumentBase.js +15 -50
  19. package/dist/core/documents/DocumentManager.d.ts +12 -16
  20. package/dist/core/documents/DocumentManager.js +32 -26
  21. package/dist/core/documents/DocumentMapper.js +3 -1
  22. package/dist/core/documents/index.d.ts +1 -1
  23. package/dist/core/documents/index.js +6 -2
  24. package/dist/core/documents/parseAstro.d.ts +2 -2
  25. package/dist/core/documents/parseHtml.d.ts +2 -2
  26. package/dist/core/documents/parseHtml.js +4 -1
  27. package/dist/core/documents/utils.d.ts +22 -26
  28. package/dist/core/documents/utils.js +96 -134
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.js +1 -3
  31. package/dist/node.d.ts +1 -0
  32. package/dist/node.js +29 -0
  33. package/dist/plugins/PluginHost.d.ts +8 -9
  34. package/dist/plugins/PluginHost.js +22 -36
  35. package/dist/plugins/astro/AstroPlugin.d.ts +11 -12
  36. package/dist/plugins/astro/AstroPlugin.js +17 -38
  37. package/dist/plugins/astro/features/{CompletionProvider.d.ts → CompletionsProvider.d.ts} +5 -5
  38. package/dist/plugins/astro/features/{CompletionProvider.js → CompletionsProvider.js} +33 -54
  39. package/dist/plugins/css/CSSDocument.d.ts +3 -3
  40. package/dist/plugins/css/CSSDocument.js +7 -16
  41. package/dist/plugins/css/CSSPlugin.d.ts +19 -11
  42. package/dist/plugins/css/CSSPlugin.js +63 -41
  43. package/dist/plugins/css/StyleAttributeDocument.d.ts +2 -2
  44. package/dist/plugins/css/StyleAttributeDocument.js +2 -2
  45. package/dist/plugins/css/features/astro-selectors.d.ts +2 -0
  46. package/dist/plugins/css/features/astro-selectors.js +16 -0
  47. package/dist/plugins/css/features/{getIdClassCompletion.d.ts → getIdClassCompletions.d.ts} +3 -3
  48. package/dist/plugins/css/features/{getIdClassCompletion.js → getIdClassCompletions.js} +10 -9
  49. package/dist/plugins/css/{service.d.ts → language-service.d.ts} +0 -0
  50. package/dist/plugins/css/{service.js → language-service.js} +2 -1
  51. package/dist/plugins/html/HTMLPlugin.d.ts +15 -17
  52. package/dist/plugins/html/HTMLPlugin.js +33 -41
  53. package/dist/plugins/index.d.ts +2 -2
  54. package/dist/plugins/index.js +7 -3
  55. package/dist/plugins/interfaces.d.ts +35 -48
  56. package/dist/plugins/typescript/LanguageServiceManager.d.ts +33 -14
  57. package/dist/plugins/typescript/LanguageServiceManager.js +57 -32
  58. package/dist/plugins/typescript/TypeScriptPlugin.d.ts +16 -23
  59. package/dist/plugins/typescript/TypeScriptPlugin.js +48 -56
  60. package/dist/plugins/typescript/astro-sys.d.ts +5 -3
  61. package/dist/plugins/typescript/astro-sys.js +24 -41
  62. package/dist/plugins/typescript/features/CompletionsProvider.d.ts +6 -6
  63. package/dist/plugins/typescript/features/CompletionsProvider.js +17 -33
  64. package/dist/plugins/typescript/features/DiagnosticsProvider.d.ts +4 -4
  65. package/dist/plugins/typescript/features/DiagnosticsProvider.js +22 -61
  66. package/dist/plugins/typescript/features/HoverProvider.d.ts +4 -5
  67. package/dist/plugins/typescript/features/HoverProvider.js +9 -10
  68. package/dist/plugins/typescript/features/SignatureHelpProvider.d.ts +4 -5
  69. package/dist/plugins/typescript/features/SignatureHelpProvider.js +15 -11
  70. package/dist/plugins/typescript/features/utils.d.ts +1 -12
  71. package/dist/plugins/typescript/features/utils.js +2 -22
  72. package/dist/plugins/typescript/language-service.d.ts +38 -0
  73. package/dist/plugins/typescript/language-service.js +227 -0
  74. package/dist/plugins/typescript/module-loader.d.ts +5 -8
  75. package/dist/plugins/typescript/module-loader.js +43 -23
  76. package/dist/plugins/typescript/{DocumentSnapshot.d.ts → snapshots/DocumentSnapshot.d.ts} +45 -42
  77. package/dist/plugins/typescript/snapshots/DocumentSnapshot.js +135 -0
  78. package/dist/plugins/typescript/snapshots/SnapshotManager.d.ts +42 -0
  79. package/dist/plugins/typescript/snapshots/SnapshotManager.js +197 -0
  80. package/dist/plugins/typescript/snapshots/utils.d.ts +28 -0
  81. package/dist/plugins/typescript/snapshots/utils.js +84 -0
  82. package/dist/plugins/typescript/utils.d.ts +10 -11
  83. package/dist/plugins/typescript/utils.js +122 -151
  84. package/dist/server.d.ts +2 -4
  85. package/dist/server.js +88 -54
  86. package/dist/utils.d.ts +16 -8
  87. package/dist/utils.js +29 -14
  88. package/package.json +19 -13
  89. package/bin/server.js +0 -7
  90. package/dist/core/documents/Document.d.ts +0 -51
  91. package/dist/core/documents/Document.js +0 -135
  92. package/dist/plugins/typescript/DocumentSnapshot.js +0 -202
  93. package/dist/plugins/typescript/SnapshotManager.d.ts +0 -24
  94. package/dist/plugins/typescript/SnapshotManager.js +0 -97
  95. package/dist/plugins/typescript/languageService.d.ts +0 -17
  96. package/dist/plugins/typescript/languageService.js +0 -169
  97. package/types/index.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @astrojs/language-server
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8a58a56: Refactor the language-server, fixes many issues related to imports, add support for completions in multiple style tags
8
+
9
+ ## 0.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - fd92a85: Add support for loading files from non-JSX frameworks such as Vue and Svelte
14
+
15
+ ### Patch Changes
16
+
17
+ - d056cd5: Fixes production bugs in extension
18
+
19
+ ## 0.9.3
20
+
21
+ ### Patch Changes
22
+
23
+ - c4d43b4: Deploy to OpenVSX
24
+
3
25
  ## 0.9.2
4
26
 
5
27
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env node
2
+
3
+ require('../dist/browser.js');
@@ -0,0 +1,3 @@
1
+ #! /usr/bin/env node
2
+
3
+ require('../dist/node.js');
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const browser_1 = require("vscode-languageserver/browser");
4
+ const server_1 = require("./server");
5
+ const messageReader = new browser_1.BrowserMessageReader(self);
6
+ const messageWriter = new browser_1.BrowserMessageWriter(self);
7
+ const connection = (0, browser_1.createConnection)(messageReader, messageWriter);
8
+ (0, server_1.startLanguageServer)(connection);
package/dist/check.js CHANGED
@@ -15,11 +15,8 @@ class AstroCheck {
15
15
  }
16
16
  upsertDocument(doc) {
17
17
  this.docManager.openDocument({
18
- languageId: 'astro',
19
- version: 0,
20
18
  text: doc.text,
21
19
  uri: doc.uri,
22
- overrideText: true
23
20
  });
24
21
  this.docManager.markAsOpenedInClient(doc.uri);
25
22
  }
@@ -37,7 +34,7 @@ class AstroCheck {
37
34
  }));
38
35
  }
39
36
  initialize(workspacePath) {
40
- this.pluginHost.register(new plugins_1.TypeScriptPlugin(this.docManager, this.configManager, [workspacePath]));
37
+ this.pluginHost.registerPlugin(new plugins_1.TypeScriptPlugin(this.docManager, this.configManager, [workspacePath]));
41
38
  }
42
39
  async getDiagnosticsForFile(uri) {
43
40
  var _a;
@@ -45,7 +42,7 @@ class AstroCheck {
45
42
  return {
46
43
  filePath: new URL(uri).pathname || '',
47
44
  text: ((_a = this.docManager.get(uri)) === null || _a === void 0 ? void 0 : _a.getText()) || '',
48
- diagnostics
45
+ diagnostics,
49
46
  };
50
47
  }
51
48
  }
@@ -1,5 +1,5 @@
1
1
  import { Connection, TextDocumentIdentifier, Diagnostic } from 'vscode-languageserver';
2
- import { DocumentManager, Document } from './documents';
2
+ import { DocumentManager, AstroDocument } from './documents';
3
3
  export declare type SendDiagnostics = Connection['sendDiagnostics'];
4
4
  export declare type GetDiagnostics = (doc: TextDocumentIdentifier) => Thenable<Diagnostic[]>;
5
5
  export declare class DiagnosticsManager {
@@ -8,6 +8,6 @@ export declare class DiagnosticsManager {
8
8
  private getDiagnostics;
9
9
  constructor(sendDiagnostics: SendDiagnostics, docManager: DocumentManager, getDiagnostics: GetDiagnostics);
10
10
  updateAll(): void;
11
- update(document: Document): Promise<void>;
12
- removeDiagnostics(document: Document): void;
11
+ update(document: AstroDocument): Promise<void>;
12
+ removeDiagnostics(document: AstroDocument): void;
13
13
  }
@@ -16,13 +16,13 @@ class DiagnosticsManager {
16
16
  const diagnostics = await this.getDiagnostics({ uri: document.getURL() });
17
17
  this.sendDiagnostics({
18
18
  uri: document.getURL(),
19
- diagnostics
19
+ diagnostics,
20
20
  });
21
21
  }
22
22
  removeDiagnostics(document) {
23
23
  this.sendDiagnostics({
24
24
  uri: document.getURL(),
25
- diagnostics: []
25
+ diagnostics: [],
26
26
  });
27
27
  }
28
28
  }
@@ -1,178 +1,33 @@
1
1
  import { VSCodeEmmetConfig } from '@vscode/emmet-helper';
2
- import { UserPreferences } from 'typescript';
3
- /**
4
- * Representation of the language server config.
5
- */
6
- export interface LSConfig {
7
- typescript: LSTypescriptConfig;
8
- css: LSCSSConfig;
9
- html: LSHTMLConfig;
10
- astro: LSAstroConfig;
11
- }
12
- export interface LSTypescriptConfig {
13
- enable: boolean;
14
- diagnostics: {
15
- enable: boolean;
16
- };
17
- hover: {
18
- enable: boolean;
19
- };
20
- documentSymbols: {
21
- enable: boolean;
22
- };
23
- completions: {
24
- enable: boolean;
25
- };
26
- findReferences: {
27
- enable: boolean;
28
- };
29
- definitions: {
30
- enable: boolean;
31
- };
32
- codeActions: {
33
- enable: boolean;
34
- };
35
- rename: {
36
- enable: boolean;
37
- };
38
- selectionRange: {
39
- enable: boolean;
40
- };
41
- signatureHelp: {
42
- enable: boolean;
43
- };
44
- semanticTokens: {
45
- enable: boolean;
46
- };
47
- }
48
- export interface LSCSSConfig {
49
- enable: boolean;
50
- globals: string;
51
- diagnostics: {
52
- enable: boolean;
53
- };
54
- hover: {
55
- enable: boolean;
56
- };
57
- completions: {
58
- enable: boolean;
59
- emmet: boolean;
60
- };
61
- documentColors: {
62
- enable: boolean;
63
- };
64
- colorPresentations: {
65
- enable: boolean;
66
- };
67
- documentSymbols: {
68
- enable: boolean;
69
- };
70
- selectionRange: {
71
- enable: boolean;
72
- };
73
- }
74
- export interface LSHTMLConfig {
75
- enable: boolean;
76
- hover: {
77
- enable: boolean;
78
- };
79
- completions: {
80
- enable: boolean;
81
- emmet: boolean;
82
- };
83
- tagComplete: {
84
- enable: boolean;
85
- };
86
- documentSymbols: {
87
- enable: boolean;
88
- };
89
- renameTags: {
90
- enable: boolean;
91
- };
92
- linkedEditing: {
93
- enable: boolean;
94
- };
95
- }
96
- export declare type CompilerWarningsSettings = Record<string, 'ignore' | 'error'>;
97
- export interface LSAstroConfig {
98
- enable: boolean;
99
- compilerWarnings: CompilerWarningsSettings;
100
- diagnostics: {
101
- enable: boolean;
102
- };
103
- format: {
104
- enable: boolean;
105
- };
106
- rename: {
107
- enable: boolean;
108
- };
109
- completions: {
110
- enable: boolean;
111
- };
112
- hover: {
113
- enable: boolean;
114
- };
115
- codeActions: {
116
- enable: boolean;
117
- };
118
- selectionRange: {
119
- enable: boolean;
120
- };
121
- }
122
- export declare type TsUserConfigLang = 'typescript' | 'javascript';
123
- declare type DeepPartial<T> = T extends CompilerWarningsSettings ? T : {
2
+ import { LSConfig } from './interfaces';
3
+ declare type DeepPartial<T> = T extends Record<string, unknown> ? {
124
4
  [P in keyof T]?: DeepPartial<T[P]>;
125
- };
126
- /**
127
- * A subset of the JS/TS VS Code settings which
128
- * are transformed to ts.UserPreferences.
129
- * It may not be available in other IDEs, that's why the keys are optional.
130
- */
131
- export interface TSUserConfig {
132
- preferences?: TsUserPreferencesConfig;
133
- suggest?: TSSuggestConfig;
134
- }
5
+ } : T;
135
6
  /**
136
- * A subset of the JS/TS VS Code settings which
137
- * are transformed to ts.UserPreferences.
7
+ * Manager class to facilitate accessing and updating the user's config
8
+ * Not to be confused with other kind of configurations (such as the Astro project configuration and the TypeScript/Javascript one)
9
+ * For more info on this, see the [internal docs](../../../../../docs/internal/language-server/config.md)
138
10
  */
139
- export interface TsUserPreferencesConfig {
140
- importModuleSpecifier: UserPreferences['importModuleSpecifierPreference'];
141
- quoteStyle: UserPreferences['quotePreference'];
142
- }
143
- /**
144
- * A subset of the JS/TS VS Code settings which
145
- * are transformed to ts.UserPreferences.
146
- */
147
- export interface TSSuggestConfig {
148
- includeAutomaticOptionalChainCompletions: boolean | undefined;
149
- }
150
11
  export declare class ConfigManager {
151
12
  private config;
152
- private listeners;
153
13
  private emmetConfig;
154
- private tsUserPreferences;
155
- /**
156
- * Updates config.
157
- */
158
- update(config: DeepPartial<LSConfig>): void;
14
+ private isTrusted;
15
+ updateConfig(config: DeepPartial<LSConfig>): void;
16
+ updateEmmetConfig(config: VSCodeEmmetConfig): void;
17
+ getEmmetConfig(): VSCodeEmmetConfig;
159
18
  /**
160
- * Whether or not specified config is enabled
161
- * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
162
- */
19
+ * Whether or not specified setting is enabled
20
+ * @param key a string which is a path. Example: 'astro.diagnostics.enabled'.
21
+ */
163
22
  enabled(key: string): boolean;
164
23
  /**
165
- * Get specific config
166
- * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
167
- */
24
+ * Get a specific setting value
25
+ * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
26
+ */
168
27
  get<T>(key: string): T;
169
28
  /**
170
- * Register a listener which is invoked when the config changed.
171
- */
172
- onChange(callback: (config: ConfigManager) => void): void;
173
- updateEmmetConfig(config: VSCodeEmmetConfig): void;
174
- updateTsJsUserPreferences(config: Record<TsUserConfigLang, TSUserConfig>): void;
175
- private _updateTsUserPreferences;
176
- getEmmetConfig(): VSCodeEmmetConfig;
29
+ * Get the entire user configuration
30
+ */
31
+ getFullConfig(): Readonly<LSConfig>;
177
32
  }
178
33
  export {};
@@ -2,134 +2,95 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigManager = void 0;
4
4
  const lodash_1 = require("lodash");
5
- /**
6
- * Default config for the language server.
7
- */
8
5
  const defaultLSConfig = {
6
+ astro: {
7
+ enabled: true,
8
+ diagnostics: { enabled: true },
9
+ rename: { enabled: true },
10
+ format: { enabled: true },
11
+ completions: { enabled: true },
12
+ hover: { enabled: true },
13
+ codeActions: { enabled: true },
14
+ selectionRange: { enabled: true },
15
+ },
9
16
  typescript: {
10
- enable: true,
11
- diagnostics: { enable: true },
12
- hover: { enable: true },
13
- completions: { enable: true },
14
- definitions: { enable: true },
15
- findReferences: { enable: true },
16
- documentSymbols: { enable: true },
17
- codeActions: { enable: true },
18
- rename: { enable: true },
19
- selectionRange: { enable: true },
20
- signatureHelp: { enable: true },
21
- semanticTokens: { enable: true }
17
+ enabled: true,
18
+ diagnostics: { enabled: true },
19
+ hover: { enabled: true },
20
+ completions: { enabled: true },
21
+ definitions: { enabled: true },
22
+ findReferences: { enabled: true },
23
+ documentSymbols: { enabled: true },
24
+ codeActions: { enabled: true },
25
+ rename: { enabled: true },
26
+ selectionRange: { enabled: true },
27
+ signatureHelp: { enabled: true },
28
+ semanticTokens: { enabled: true },
29
+ implementation: { enabled: true },
30
+ typeDefinition: { enabled: true },
22
31
  },
23
32
  css: {
24
- enable: true,
25
- globals: '',
26
- diagnostics: { enable: true },
27
- hover: { enable: true },
28
- completions: { enable: true, emmet: true },
29
- documentColors: { enable: true },
30
- colorPresentations: { enable: true },
31
- documentSymbols: { enable: true },
32
- selectionRange: { enable: true }
33
+ enabled: true,
34
+ diagnostics: { enabled: true },
35
+ hover: { enabled: true },
36
+ completions: { enabled: true, emmet: true },
37
+ documentColors: { enabled: true },
38
+ colorPresentations: { enabled: true },
39
+ documentSymbols: { enabled: true },
40
+ selectionRange: { enabled: true },
33
41
  },
34
42
  html: {
35
- enable: true,
36
- hover: { enable: true },
37
- completions: { enable: true, emmet: true },
38
- tagComplete: { enable: true },
39
- documentSymbols: { enable: true },
40
- renameTags: { enable: true },
41
- linkedEditing: { enable: true }
43
+ enabled: true,
44
+ hover: { enabled: true },
45
+ completions: { enabled: true, emmet: true },
46
+ tagComplete: { enabled: true },
47
+ documentSymbols: { enabled: true },
48
+ renameTags: { enabled: true },
49
+ linkedEditing: { enabled: true },
42
50
  },
43
- astro: {
44
- enable: true,
45
- compilerWarnings: {},
46
- diagnostics: { enable: true },
47
- rename: { enable: true },
48
- format: {
49
- enable: true
50
- },
51
- completions: { enable: true },
52
- hover: { enable: true },
53
- codeActions: { enable: true },
54
- selectionRange: { enable: true }
55
- }
56
51
  };
52
+ /**
53
+ * Manager class to facilitate accessing and updating the user's config
54
+ * Not to be confused with other kind of configurations (such as the Astro project configuration and the TypeScript/Javascript one)
55
+ * For more info on this, see the [internal docs](../../../../../docs/internal/language-server/config.md)
56
+ */
57
57
  class ConfigManager {
58
58
  constructor() {
59
59
  this.config = defaultLSConfig;
60
- this.listeners = [];
61
60
  this.emmetConfig = {};
62
- this.tsUserPreferences = {
63
- typescript: {
64
- includeCompletionsForImportStatements: true,
65
- includeCompletionsWithInsertText: true,
66
- includeAutomaticOptionalChainCompletions: true
67
- },
68
- javascript: {
69
- includeCompletionsForImportStatements: true,
70
- includeCompletionsWithInsertText: true,
71
- includeAutomaticOptionalChainCompletions: true
72
- }
73
- };
61
+ this.isTrusted = true;
74
62
  }
75
- /**
76
- * Updates config.
77
- */
78
- update(config) {
79
- var _a;
63
+ updateConfig(config) {
80
64
  // Ideally we shouldn't need the merge here because all updates should be valid and complete configs.
81
65
  // But since those configs come from the client they might be out of synch with the valid config:
82
66
  // We might at some point in the future forget to synch config settings in all packages after updating the config.
83
67
  this.config = (0, lodash_1.merge)({}, defaultLSConfig, this.config, config);
84
- // Merge will keep arrays/objects if the new one is empty/has less entries,
85
- // therefore we need some extra checks if there are new settings
86
- if ((_a = config.astro) === null || _a === void 0 ? void 0 : _a.compilerWarnings) {
87
- this.config.astro.compilerWarnings = config.astro.compilerWarnings;
88
- }
89
- this.listeners.forEach((listener) => listener(this));
68
+ }
69
+ updateEmmetConfig(config) {
70
+ this.emmetConfig = config || {};
71
+ }
72
+ getEmmetConfig() {
73
+ return this.emmetConfig;
90
74
  }
91
75
  /**
92
- * Whether or not specified config is enabled
93
- * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
94
- */
76
+ * Whether or not specified setting is enabled
77
+ * @param key a string which is a path. Example: 'astro.diagnostics.enabled'.
78
+ */
95
79
  enabled(key) {
96
80
  return !!this.get(key);
97
81
  }
98
82
  /**
99
- * Get specific config
100
- * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
101
- */
83
+ * Get a specific setting value
84
+ * @param key a string which is a path. Example: 'astro.diagnostics.enable'.
85
+ */
102
86
  get(key) {
103
87
  return (0, lodash_1.get)(this.config, key);
104
88
  }
105
89
  /**
106
- * Register a listener which is invoked when the config changed.
107
- */
108
- onChange(callback) {
109
- this.listeners.push(callback);
110
- }
111
- updateEmmetConfig(config) {
112
- this.emmetConfig = config || {};
113
- }
114
- updateTsJsUserPreferences(config) {
115
- ['typescript', 'javascript'].forEach((lang) => {
116
- if (config[lang]) {
117
- this._updateTsUserPreferences(lang, config[lang]);
118
- }
119
- });
120
- }
121
- _updateTsUserPreferences(lang, config) {
122
- var _a, _b, _c, _d;
123
- this.tsUserPreferences[lang] = {
124
- ...this.tsUserPreferences[lang],
125
- importModuleSpecifierPreference: (_a = config.preferences) === null || _a === void 0 ? void 0 : _a.importModuleSpecifier,
126
- quotePreference: (_b = config.preferences) === null || _b === void 0 ? void 0 : _b.quoteStyle,
127
- includeAutomaticOptionalChainCompletions: (_d = (_c = config.suggest) === null || _c === void 0 ? void 0 : _c.includeAutomaticOptionalChainCompletions) !== null && _d !== void 0 ? _d : true,
128
- includeCompletionsWithInsertText: true
129
- };
130
- }
131
- getEmmetConfig() {
132
- return this.emmetConfig;
90
+ * Get the entire user configuration
91
+ */
92
+ getFullConfig() {
93
+ return this.config;
133
94
  }
134
95
  }
135
96
  exports.ConfigManager = ConfigManager;
@@ -1 +1,2 @@
1
1
  export * from './ConfigManager';
2
+ export * from './interfaces';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./ConfigManager"), exports);
18
+ __exportStar(require("./interfaces"), exports);
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Representation of the language server config.
3
+ * Make sure that this is kept in sync with the `package.json` of the VS Code extension
4
+ */
5
+ export interface LSConfig {
6
+ astro: LSAstroConfig;
7
+ typescript: LSTypescriptConfig;
8
+ html: LSHTMLConfig;
9
+ css: LSCSSConfig;
10
+ }
11
+ export interface LSAstroConfig {
12
+ enabled: boolean;
13
+ diagnostics: {
14
+ enabled: boolean;
15
+ };
16
+ format: {
17
+ enabled: boolean;
18
+ };
19
+ rename: {
20
+ enabled: boolean;
21
+ };
22
+ completions: {
23
+ enabled: boolean;
24
+ };
25
+ hover: {
26
+ enabled: boolean;
27
+ };
28
+ codeActions: {
29
+ enabled: boolean;
30
+ };
31
+ selectionRange: {
32
+ enabled: boolean;
33
+ };
34
+ }
35
+ export interface LSTypescriptConfig {
36
+ enabled: boolean;
37
+ diagnostics: {
38
+ enabled: boolean;
39
+ };
40
+ hover: {
41
+ enabled: boolean;
42
+ };
43
+ documentSymbols: {
44
+ enabled: boolean;
45
+ };
46
+ completions: {
47
+ enabled: boolean;
48
+ };
49
+ findReferences: {
50
+ enabled: boolean;
51
+ };
52
+ definitions: {
53
+ enabled: boolean;
54
+ };
55
+ codeActions: {
56
+ enabled: boolean;
57
+ };
58
+ rename: {
59
+ enabled: boolean;
60
+ };
61
+ selectionRange: {
62
+ enabled: boolean;
63
+ };
64
+ signatureHelp: {
65
+ enabled: boolean;
66
+ };
67
+ semanticTokens: {
68
+ enabled: boolean;
69
+ };
70
+ implementation: {
71
+ enabled: boolean;
72
+ };
73
+ typeDefinition: {
74
+ enabled: boolean;
75
+ };
76
+ }
77
+ export interface LSHTMLConfig {
78
+ enabled: boolean;
79
+ hover: {
80
+ enabled: boolean;
81
+ };
82
+ completions: {
83
+ enabled: boolean;
84
+ emmet: boolean;
85
+ };
86
+ tagComplete: {
87
+ enabled: boolean;
88
+ };
89
+ documentSymbols: {
90
+ enabled: boolean;
91
+ };
92
+ renameTags: {
93
+ enabled: boolean;
94
+ };
95
+ linkedEditing: {
96
+ enabled: boolean;
97
+ };
98
+ }
99
+ export interface LSCSSConfig {
100
+ enabled: boolean;
101
+ diagnostics: {
102
+ enabled: boolean;
103
+ };
104
+ hover: {
105
+ enabled: boolean;
106
+ };
107
+ completions: {
108
+ enabled: boolean;
109
+ emmet: boolean;
110
+ };
111
+ documentColors: {
112
+ enabled: boolean;
113
+ };
114
+ colorPresentations: {
115
+ enabled: boolean;
116
+ };
117
+ documentSymbols: {
118
+ enabled: boolean;
119
+ };
120
+ selectionRange: {
121
+ enabled: boolean;
122
+ };
123
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { HTMLDocument } from 'vscode-html-languageservice';
2
+ import { WritableDocument } from './DocumentBase';
3
+ import { AstroMetadata } from './parseAstro';
4
+ import { TagInformation } from './utils';
5
+ export declare class AstroDocument extends WritableDocument {
6
+ url: string;
7
+ content: string;
8
+ languageId: string;
9
+ astroMeta: AstroMetadata;
10
+ html: HTMLDocument;
11
+ styleTags: TagInformation[];
12
+ constructor(url: string, content: string);
13
+ private updateDocInfo;
14
+ setText(text: string): void;
15
+ getText(): string;
16
+ getURL(): string;
17
+ getFilePath(): string | null;
18
+ }