@astrojs/language-server 0.24.0 → 0.25.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 (25) hide show
  1. package/dist/check.d.ts +1 -2
  2. package/dist/check.js +5 -5
  3. package/dist/plugins/astro/features/CompletionsProvider.js +1 -1
  4. package/dist/plugins/typescript/TypeScriptPlugin.js +1 -1
  5. package/dist/plugins/typescript/features/CodeActionsProvider.js +4 -4
  6. package/dist/plugins/typescript/features/CompletionsProvider.js +1 -1
  7. package/dist/plugins/typescript/features/DefinitionsProvider.js +3 -4
  8. package/dist/plugins/typescript/features/DiagnosticsProvider.js +4 -5
  9. package/dist/plugins/typescript/features/DocumentSymbolsProvider.js +1 -1
  10. package/dist/plugins/typescript/features/FoldingRangesProvider.js +1 -2
  11. package/dist/plugins/typescript/features/HoverProvider.js +1 -2
  12. package/dist/plugins/typescript/features/InlayHintsProvider.js +1 -3
  13. package/dist/plugins/typescript/features/SemanticTokenProvider.js +1 -3
  14. package/dist/plugins/typescript/features/SignatureHelpProvider.js +1 -2
  15. package/dist/plugins/typescript/features/TypeDefinitionsProvider.js +3 -4
  16. package/dist/plugins/typescript/language-service.js +30 -16
  17. package/dist/plugins/typescript/module-loader.d.ts +1 -1
  18. package/dist/plugins/typescript/module-loader.js +37 -6
  19. package/dist/plugins/typescript/snapshots/DocumentSnapshot.d.ts +2 -2
  20. package/dist/plugins/typescript/snapshots/DocumentSnapshot.js +2 -2
  21. package/dist/plugins/typescript/snapshots/SnapshotManager.js +2 -4
  22. package/dist/plugins/typescript/utils.d.ts +1 -0
  23. package/dist/plugins/typescript/utils.js +8 -1
  24. package/package.json +12 -11
  25. package/CHANGELOG.md +0 -520
package/dist/check.d.ts CHANGED
@@ -3,7 +3,7 @@ import { LSConfig } from './core/config';
3
3
  export { DiagnosticSeverity } from 'vscode-languageserver-types';
4
4
  export { Diagnostic };
5
5
  export interface GetDiagnosticsResult {
6
- filePath: string;
6
+ fileUri: string;
7
7
  text: string;
8
8
  diagnostics: Diagnostic[];
9
9
  }
@@ -11,7 +11,6 @@ export declare class AstroCheck {
11
11
  private docManager;
12
12
  private configManager;
13
13
  private pluginHost;
14
- private ts;
15
14
  constructor(workspacePath: string, typescriptPath: string, options?: LSConfig);
16
15
  upsertDocument(doc: {
17
16
  text: string;
package/dist/check.js CHANGED
@@ -13,9 +13,9 @@ class AstroCheck {
13
13
  this.docManager = documents_1.DocumentManager.newInstance();
14
14
  this.configManager = new config_1.ConfigManager();
15
15
  this.pluginHost = new plugins_1.PluginHost(this.docManager);
16
- this.initialize(workspacePath);
17
16
  try {
18
- this.ts = require(typescriptPath);
17
+ const ts = require(typescriptPath);
18
+ this.initialize(workspacePath, ts);
19
19
  }
20
20
  catch (e) {
21
21
  throw new Error(`Couldn't load TypeScript from path ${typescriptPath}`);
@@ -44,14 +44,14 @@ class AstroCheck {
44
44
  return await this.getDiagnosticsForFile(uri);
45
45
  }));
46
46
  }
47
- initialize(workspacePath) {
48
- const languageServiceManager = new LanguageServiceManager_1.LanguageServiceManager(this.docManager, [(0, utils_1.normalizeUri)(workspacePath)], this.configManager, this.ts);
47
+ initialize(workspacePath, ts) {
48
+ const languageServiceManager = new LanguageServiceManager_1.LanguageServiceManager(this.docManager, [(0, utils_1.normalizeUri)(workspacePath)], this.configManager, ts);
49
49
  this.pluginHost.registerPlugin(new plugins_1.TypeScriptPlugin(this.configManager, languageServiceManager));
50
50
  }
51
51
  async getDiagnosticsForFile(uri) {
52
52
  const diagnostics = await this.pluginHost.getDiagnostics({ uri });
53
53
  return {
54
- filePath: new URL(uri).pathname || '',
54
+ fileUri: uri || '',
55
55
  text: this.docManager.get(uri)?.getText() || '',
56
56
  diagnostics,
57
57
  };
@@ -102,7 +102,7 @@ class CompletionsProviderImpl {
102
102
  const componentName = node.tag;
103
103
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
104
104
  // Get the source file
105
- const tsFilePath = (0, utils_3.toVirtualAstroFilePath)(tsDoc.filePath);
105
+ const tsFilePath = tsDoc.filePath;
106
106
  const program = lang.getProgram();
107
107
  const sourceFile = program?.getSourceFile(tsFilePath);
108
108
  const typeChecker = program?.getTypeChecker();
@@ -47,7 +47,7 @@ class TypeScriptPlugin {
47
47
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
48
48
  const fragment = await tsDoc.createFragment();
49
49
  const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
50
- let renames = lang.findRenameLocations((0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath), offset, false, false, true);
50
+ let renames = lang.findRenameLocations(tsDoc.filePath, offset, false, false, true);
51
51
  if (!renames) {
52
52
  return null;
53
53
  }
@@ -17,7 +17,6 @@ class CodeActionsProviderImpl {
17
17
  }
18
18
  async getCodeActions(document, range, context, cancellationToken) {
19
19
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
20
- const filePath = (0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath);
21
20
  const fragment = await tsDoc.createFragment();
22
21
  const tsPreferences = await this.configManager.getTSPreferences(document);
23
22
  const formatOptions = await this.configManager.getTSFormatConfig(document);
@@ -63,10 +62,11 @@ class CodeActionsProviderImpl {
63
62
  const start = fragment.offsetAt(fragment.getGeneratedPosition(range.start));
64
63
  const end = fragment.offsetAt(fragment.getGeneratedPosition(range.end));
65
64
  codeFixes = errorCodes.includes(2304)
66
- ? this.getComponentQuickFix(start, end, lang, filePath, formatOptions, tsPreferences)
65
+ ? this.getComponentQuickFix(start, end, lang, tsDoc.filePath, formatOptions, tsPreferences)
67
66
  : undefined;
68
67
  codeFixes =
69
- codeFixes ?? lang.getCodeFixesAtPosition(filePath, start, end, errorCodes, formatOptions, tsPreferences);
68
+ codeFixes ??
69
+ lang.getCodeFixesAtPosition(tsDoc.filePath, start, end, errorCodes, formatOptions, tsPreferences);
70
70
  }
71
71
  const codeActions = codeFixes.map((fix) => codeFixToCodeAction(fix, context.diagnostics, context.only ? vscode_languageserver_types_1.CodeActionKind.QuickFix : vscode_languageserver_types_1.CodeActionKind.Empty, isInsideScript, this.ts));
72
72
  result.push(...codeActions);
@@ -144,7 +144,7 @@ class CodeActionsProviderImpl {
144
144
  }
145
145
  async organizeSortImports(document, skipDestructiveCodeActions = false, cancellationToken) {
146
146
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
147
- const filePath = (0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath);
147
+ const filePath = tsDoc.filePath;
148
148
  const fragment = await tsDoc.createFragment();
149
149
  if (cancellationToken?.isCancellationRequested) {
150
150
  return [];
@@ -59,7 +59,7 @@ class CompletionsProviderImpl {
59
59
  const offset = document.offsetAt(position);
60
60
  const node = html.findNodeAt(offset);
61
61
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
62
- let filePath = (0, utils_3.toVirtualAstroFilePath)(tsDoc.filePath);
62
+ let filePath = tsDoc.filePath;
63
63
  let completions;
64
64
  const isCompletionInsideFrontmatter = (0, utils_1.isInsideFrontmatter)(document.getText(), offset);
65
65
  const isCompletionInsideExpression = (0, utils_1.isInsideExpression)(document.getText(), node.start, offset);
@@ -12,7 +12,6 @@ class DefinitionsProviderImpl {
12
12
  async getDefinitions(document, position) {
13
13
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
14
14
  const mainFragment = await tsDoc.createFragment();
15
- const tsFilePath = (0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath);
16
15
  const fragmentPosition = mainFragment.getGeneratedPosition(position);
17
16
  const fragmentOffset = mainFragment.offsetAt(fragmentPosition);
18
17
  let defs;
@@ -25,7 +24,7 @@ class DefinitionsProviderImpl {
25
24
  if (defs) {
26
25
  defs.definitions = defs.definitions?.map((def) => {
27
26
  const isInSameFile = def.fileName === scriptFilePath;
28
- def.fileName = isInSameFile ? tsFilePath : def.fileName;
27
+ def.fileName = isInSameFile ? tsDoc.filePath : def.fileName;
29
28
  if (isInSameFile) {
30
29
  def.textSpan.start = mainFragment.offsetAt(scriptTagSnapshot.getOriginalPosition(scriptTagSnapshot.positionAt(def.textSpan.start)));
31
30
  }
@@ -35,13 +34,13 @@ class DefinitionsProviderImpl {
35
34
  }
36
35
  }
37
36
  else {
38
- defs = lang.getDefinitionAndBoundSpan(tsFilePath, fragmentOffset);
37
+ defs = lang.getDefinitionAndBoundSpan(tsDoc.filePath, fragmentOffset);
39
38
  }
40
39
  if (!defs || !defs.definitions) {
41
40
  return [];
42
41
  }
43
42
  const docs = new utils_3.SnapshotFragmentMap(this.languageServiceManager);
44
- docs.set(tsFilePath, { fragment: mainFragment, snapshot: tsDoc });
43
+ docs.set(tsDoc.filePath, { fragment: mainFragment, snapshot: tsDoc });
45
44
  const result = await Promise.all(defs.definitions.map(async (def) => {
46
45
  const { fragment, snapshot } = await docs.retrieve(def.fileName);
47
46
  const fileName = (0, utils_2.ensureRealFilePath)(def.fileName);
@@ -31,7 +31,6 @@ class DiagnosticsProviderImpl {
31
31
  return [];
32
32
  }
33
33
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
34
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
35
34
  const fragment = await tsDoc.createFragment();
36
35
  let scriptDiagnostics = [];
37
36
  document.scriptTags.forEach((scriptTag) => {
@@ -54,11 +53,11 @@ class DiagnosticsProviderImpl {
54
53
  .map(mapRange(scriptTagSnapshot, document));
55
54
  scriptDiagnostics.push(...scriptDiagnostic);
56
55
  });
57
- const { script: scriptBoundaries } = this.getTagBoundaries(lang, filePath);
56
+ const { script: scriptBoundaries } = this.getTagBoundaries(lang, tsDoc.filePath);
58
57
  const diagnostics = [
59
- ...lang.getSyntacticDiagnostics(filePath),
60
- ...lang.getSuggestionDiagnostics(filePath),
61
- ...lang.getSemanticDiagnostics(filePath),
58
+ ...lang.getSyntacticDiagnostics(tsDoc.filePath),
59
+ ...lang.getSuggestionDiagnostics(tsDoc.filePath),
60
+ ...lang.getSemanticDiagnostics(tsDoc.filePath),
62
61
  ].filter((diag) => {
63
62
  return isNoWithinBoundary(scriptBoundaries, diag, this.ts);
64
63
  });
@@ -12,7 +12,7 @@ class DocumentSymbolsProviderImpl {
12
12
  async getDocumentSymbols(document) {
13
13
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
14
14
  const fragment = await tsDoc.createFragment();
15
- const navTree = lang.getNavigationTree(tsDoc.filePath);
15
+ const navTree = lang.getNavigationTree(tsDoc.filePath + '?documentSymbols');
16
16
  if (!navTree) {
17
17
  return [];
18
18
  }
@@ -11,8 +11,7 @@ class FoldingRangesProviderImpl {
11
11
  async getFoldingRanges(document) {
12
12
  const html = document.html;
13
13
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
14
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
15
- const outliningSpans = lang.getOutliningSpans(filePath).filter((span) => {
14
+ const outliningSpans = lang.getOutliningSpans(tsDoc.filePath).filter((span) => {
16
15
  const node = html.findNodeAt(span.textSpan.start);
17
16
  // Due to how our TSX output transform those tags into function calls or template literals
18
17
  // TypeScript thinks of those as outlining spans, which is fine but we don't want folding ranges for those
@@ -14,7 +14,6 @@ class HoverProviderImpl {
14
14
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
15
15
  const fragment = await tsDoc.createFragment();
16
16
  const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
17
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
18
17
  const html = document.html;
19
18
  const documentOffset = document.offsetAt(position);
20
19
  const node = html.findNodeAt(documentOffset);
@@ -27,7 +26,7 @@ class HoverProviderImpl {
27
26
  }
28
27
  }
29
28
  else {
30
- info = lang.getQuickInfoAtPosition(filePath, offset);
29
+ info = lang.getQuickInfoAtPosition(tsDoc.filePath, offset);
31
30
  }
32
31
  if (!info) {
33
32
  return null;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InlayHintsProviderImpl = void 0;
4
4
  const vscode_languageserver_1 = require("vscode-languageserver");
5
5
  const vscode_languageserver_types_1 = require("vscode-languageserver-types");
6
- const utils_1 = require("../utils");
7
6
  class InlayHintsProviderImpl {
8
7
  constructor(languageServiceManager, configManager) {
9
8
  this.languageServiceManager = languageServiceManager;
@@ -12,12 +11,11 @@ class InlayHintsProviderImpl {
12
11
  }
13
12
  async getInlayHints(document, range) {
14
13
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
15
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
16
14
  const fragment = await tsDoc.createFragment();
17
15
  const start = fragment.offsetAt(fragment.getGeneratedPosition(range.start));
18
16
  const end = fragment.offsetAt(fragment.getGeneratedPosition(range.end));
19
17
  const tsPreferences = await this.configManager.getTSPreferences(document);
20
- const inlayHints = lang.provideInlayHints(filePath, { start, length: end - start }, tsPreferences);
18
+ const inlayHints = lang.provideInlayHints(tsDoc.filePath, { start, length: end - start }, tsPreferences);
21
19
  return inlayHints.map((hint) => {
22
20
  const result = vscode_languageserver_1.InlayHint.create(fragment.getOriginalPosition(fragment.positionAt(hint.position)), hint.text, hint.kind === this.ts.InlayHintKind.Type
23
21
  ? vscode_languageserver_types_1.InlayHintKind.Type
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SemanticTokensProviderImpl = void 0;
4
4
  const vscode_languageserver_1 = require("vscode-languageserver");
5
5
  const documents_1 = require("../../../core/documents");
6
- const utils_1 = require("../utils");
7
6
  class SemanticTokensProviderImpl {
8
7
  constructor(languageServiceManager) {
9
8
  this.languageServiceManager = languageServiceManager;
@@ -15,9 +14,8 @@ class SemanticTokensProviderImpl {
15
14
  if (cancellationToken?.isCancellationRequested) {
16
15
  return null;
17
16
  }
18
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
19
17
  const start = range ? fragment.offsetAt(fragment.getGeneratedPosition(range.start)) : 0;
20
- const { spans } = lang.getEncodedSemanticClassifications(filePath, {
18
+ const { spans } = lang.getEncodedSemanticClassifications(tsDoc.filePath, {
21
19
  start,
22
20
  length: range
23
21
  ? fragment.offsetAt(fragment.getGeneratedPosition(range.end)) - start
@@ -15,7 +15,6 @@ class SignatureHelpProviderImpl {
15
15
  if (cancellationToken?.isCancellationRequested) {
16
16
  return null;
17
17
  }
18
- const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
19
18
  const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
20
19
  const node = document.html.findNodeAt(offset);
21
20
  let info;
@@ -25,7 +24,7 @@ class SignatureHelpProviderImpl {
25
24
  info = lang.getSignatureHelpItems(scriptFilePath, scriptOffset, triggerReason ? { triggerReason } : undefined);
26
25
  }
27
26
  else {
28
- info = lang.getSignatureHelpItems(filePath, offset, triggerReason ? { triggerReason } : undefined);
27
+ info = lang.getSignatureHelpItems(tsDoc.filePath, offset, triggerReason ? { triggerReason } : undefined);
29
28
  }
30
29
  if (!info) {
31
30
  return null;
@@ -14,7 +14,6 @@ class TypeDefinitionsProviderImpl {
14
14
  const { lang, tsDoc } = await this.languageServiceManager.getLSAndTSDoc(document);
15
15
  const mainFragment = await tsDoc.createFragment();
16
16
  const fragmentOffset = mainFragment.offsetAt(mainFragment.getGeneratedPosition(position));
17
- const tsFilePath = (0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath);
18
17
  const html = document.html;
19
18
  const offset = document.offsetAt(position);
20
19
  const node = html.findNodeAt(offset);
@@ -25,7 +24,7 @@ class TypeDefinitionsProviderImpl {
25
24
  if (typeDefs) {
26
25
  typeDefs = typeDefs.map((def) => {
27
26
  const isInSameFile = def.fileName === scriptFilePath;
28
- def.fileName = isInSameFile ? tsFilePath : def.fileName;
27
+ def.fileName = isInSameFile ? tsDoc.filePath : def.fileName;
29
28
  if (isInSameFile) {
30
29
  def.textSpan.start = mainFragment.offsetAt(scriptTagSnapshot.getOriginalPosition(scriptTagSnapshot.positionAt(def.textSpan.start)));
31
30
  }
@@ -34,10 +33,10 @@ class TypeDefinitionsProviderImpl {
34
33
  }
35
34
  }
36
35
  else {
37
- typeDefs = lang.getTypeDefinitionAtPosition(tsFilePath, fragmentOffset);
36
+ typeDefs = lang.getTypeDefinitionAtPosition(tsDoc.filePath, fragmentOffset);
38
37
  }
39
38
  const docs = new utils_3.SnapshotFragmentMap(this.languageServiceManager);
40
- docs.set(tsFilePath, { fragment: mainFragment, snapshot: tsDoc });
39
+ docs.set(tsDoc.filePath, { fragment: mainFragment, snapshot: tsDoc });
41
40
  if (!typeDefs) {
42
41
  return [];
43
42
  }
@@ -113,6 +113,7 @@ async function createLanguageService(tsconfigPath, docContext, workspaceUris) {
113
113
  getProjectVersion: () => projectVersion.toString(),
114
114
  getScriptFileNames: () => Array.from(new Set([...snapshotManager.getProjectFileNames(), ...snapshotManager.getFileNames(), ...scriptFileNames])),
115
115
  getScriptSnapshot,
116
+ getScriptKind: (fileName) => getScriptSnapshot(fileName).scriptKind,
116
117
  getScriptVersion: (fileName) => getScriptSnapshot(fileName).version.toString(),
117
118
  };
118
119
  if (docContext.tsLocalized) {
@@ -177,18 +178,24 @@ async function createLanguageService(tsconfigPath, docContext, workspaceUris) {
177
178
  return newSnapshot;
178
179
  }
179
180
  function getScriptSnapshot(fileName) {
180
- fileName = (0, utils_2.ensureRealFilePath)(fileName);
181
- let doc = snapshotManager.get(fileName);
181
+ const realFileName = (0, utils_2.ensureRealFilePath)(fileName);
182
+ let doc = snapshotManager.get(realFileName);
182
183
  if (doc) {
184
+ if ((0, utils_2.isDocumentSymbolsPath)(fileName)) {
185
+ return createDocumentSymbolSnapshot(doc);
186
+ }
183
187
  return doc;
184
188
  }
185
- astroModuleLoader.deleteUnresolvedResolutionsFromCache(fileName);
186
- doc = DocumentSnapshotUtils.createFromFilePath(fileName, docContext.createDocument, docContext.ts);
187
- snapshotManager.set(fileName, doc);
189
+ astroModuleLoader.deleteUnresolvedResolutionsFromCache(realFileName);
190
+ doc = DocumentSnapshotUtils.createFromFilePath(realFileName, docContext.createDocument, docContext.ts);
191
+ snapshotManager.set(realFileName, doc);
192
+ if ((0, utils_2.isDocumentSymbolsPath)(fileName)) {
193
+ return createDocumentSymbolSnapshot(doc);
194
+ }
188
195
  // If we needed to create an Astro snapshot, also create its script tags snapshots
189
- if ((0, utils_2.isAstroFilePath)(fileName)) {
196
+ if ((0, utils_2.isAstroFilePath)(realFileName)) {
190
197
  const document = doc.parent;
191
- const scriptTagSnapshots = createScriptTagsSnapshots(fileName, document);
198
+ const scriptTagSnapshots = createScriptTagsSnapshots(realFileName, document);
192
199
  scriptTagSnapshots.forEach((snapshot) => {
193
200
  snapshotManager.set(snapshot.filePath, snapshot);
194
201
  doc.scriptTagSnapshots?.push(snapshot);
@@ -217,10 +224,13 @@ async function createLanguageService(tsconfigPath, docContext, workspaceUris) {
217
224
  return document.scriptTags.map((scriptTag, index) => {
218
225
  const scriptTagLanguage = (0, utils_2.getScriptTagLanguage)(scriptTag);
219
226
  const scriptFilePath = fileName + `.__script${index}.${scriptTagLanguage}`;
220
- const scriptSnapshot = new DocumentSnapshot_1.ScriptTagDocumentSnapshot(scriptTag, document, scriptFilePath);
227
+ const scriptSnapshot = new DocumentSnapshot_1.ScriptTagDocumentSnapshot(scriptTag, document, scriptFilePath, scriptTagLanguage === 'ts' ? docContext.ts.ScriptKind.TS : docContext.ts.ScriptKind.JS);
221
228
  return scriptSnapshot;
222
229
  });
223
230
  }
231
+ function createDocumentSymbolSnapshot(doc) {
232
+ return new DocumentSnapshot_1.TypeScriptDocumentSnapshot(doc.version, doc.filePath, doc.parent.getText(), docContext.ts.ScriptKind.Unknown);
233
+ }
224
234
  function getParsedTSConfig() {
225
235
  let configJson = (tsconfigPath && docContext.ts.readConfigFile(tsconfigPath, docContext.ts.sys.readFile).config) || {};
226
236
  // Delete include so that .astro files don't get mistakenly excluded by the user
@@ -241,20 +251,24 @@ async function createLanguageService(tsconfigPath, docContext, workspaceUris) {
241
251
  module: docContext.ts.ModuleKind.ESNext,
242
252
  target: docContext.ts.ScriptTarget.ESNext,
243
253
  isolatedModules: true,
244
- moduleResolution: docContext.ts.ModuleResolutionKind.NodeJs,
245
254
  };
246
255
  const project = docContext.ts.parseJsonConfigFileContent(configJson, docContext.ts.sys, tsconfigRoot, forcedCompilerOptions, tsconfigPath, undefined, [
247
- { extension: '.vue', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
248
- { extension: '.svelte', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
249
- { extension: '.astro', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
256
+ { extension: 'vue', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
257
+ { extension: 'svelte', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
258
+ { extension: 'astro', isMixedContent: true, scriptKind: docContext.ts.ScriptKind.Deferred },
250
259
  ]);
260
+ const resultOptions = {
261
+ ...project.options,
262
+ ...forcedCompilerOptions,
263
+ };
264
+ if (!resultOptions.moduleResolution ||
265
+ resultOptions.moduleResolution === docContext.ts.ModuleResolutionKind.Classic) {
266
+ resultOptions.moduleResolution = docContext.ts.ModuleResolutionKind.NodeJs;
267
+ }
251
268
  return {
252
269
  ...project,
253
270
  fileNames: project.fileNames.map(utils_1.normalizePath),
254
- compilerOptions: {
255
- ...project.options,
256
- ...forcedCompilerOptions,
257
- },
271
+ compilerOptions: resultOptions,
258
272
  };
259
273
  }
260
274
  }
@@ -18,5 +18,5 @@ export declare function createAstroModuleLoader(getSnapshot: (fileName: string)
18
18
  readDirectory: (path: string, extensions?: readonly string[] | undefined, exclude?: readonly string[] | undefined, include?: readonly string[] | undefined, depth?: number | undefined) => string[];
19
19
  deleteFromModuleCache: (path: string) => void;
20
20
  deleteUnresolvedResolutionsFromCache: (path: string) => void;
21
- resolveModuleNames: (moduleNames: string[], containingFile: string) => Array<ts.ResolvedModule | undefined>;
21
+ resolveModuleNames: (moduleNames: string[], containingFile: string, _reusedNames: string[] | undefined, _redirectedReference: ts.ResolvedProjectReference | undefined, _options: ts.CompilerOptions, containingSourceFile?: ts.SourceFile | undefined) => Array<ts.ResolvedModule | undefined>;
22
22
  };
@@ -57,6 +57,35 @@ class ModuleResolutionCache {
57
57
  return containingFile + ':::' + (0, utils_2.ensureRealFilePath)(moduleName);
58
58
  }
59
59
  }
60
+ class ImpliedNodeFormatResolver {
61
+ constructor(ts) {
62
+ this.ts = ts;
63
+ this.alreadyResolved = new Map();
64
+ }
65
+ resolve(importPath, importIdxInFile, sourceFile, compilerOptions) {
66
+ // For Astro & Framework imports, we have to fallback to the old resolution algorithm or it doesn't work
67
+ if ((0, utils_2.isAstroFilePath)(importPath) || (0, utils_2.isFrameworkFilePath)(importPath)) {
68
+ return undefined;
69
+ }
70
+ let mode = undefined;
71
+ if (sourceFile) {
72
+ if (!sourceFile.impliedNodeFormat &&
73
+ ((0, utils_2.isAstroFilePath)(sourceFile.fileName) || (0, utils_2.isFrameworkFilePath)(sourceFile.fileName))) {
74
+ // impliedNodeFormat is not set for non-TS files, because the TS function which calculates this works with a
75
+ // fixed set of extensions that does not include frameworks files
76
+ if (!this.alreadyResolved.has(sourceFile.fileName)) {
77
+ sourceFile.impliedNodeFormat = this.ts.getImpliedNodeFormatForFile((0, utils_2.toVirtualFilePath)(sourceFile.fileName), undefined, this.ts.sys, compilerOptions);
78
+ this.alreadyResolved.set(sourceFile.fileName, sourceFile.impliedNodeFormat);
79
+ }
80
+ else {
81
+ sourceFile.impliedNodeFormat = this.alreadyResolved.get(sourceFile.fileName);
82
+ }
83
+ }
84
+ mode = this.ts.getModeForResolutionAtIndex(sourceFile, importIdxInFile);
85
+ }
86
+ return mode;
87
+ }
88
+ }
60
89
  /**
61
90
  * Creates a module loader specifically for `.astro` and other frameworks files.
62
91
  *
@@ -72,6 +101,7 @@ class ModuleResolutionCache {
72
101
  function createAstroModuleLoader(getSnapshot, compilerOptions, ts) {
73
102
  const astroSys = (0, astro_sys_1.createAstroSys)(getSnapshot, ts);
74
103
  const moduleCache = new ModuleResolutionCache();
104
+ const impliedNodeFormatResolver = new ImpliedNodeFormatResolver(ts);
75
105
  return {
76
106
  fileExists: astroSys.fileExists,
77
107
  readFile: astroSys.readFile,
@@ -86,25 +116,26 @@ function createAstroModuleLoader(getSnapshot, compilerOptions, ts) {
86
116
  },
87
117
  resolveModuleNames,
88
118
  };
89
- function resolveModuleNames(moduleNames, containingFile) {
90
- return moduleNames.map((moduleName) => {
119
+ function resolveModuleNames(moduleNames, containingFile, _reusedNames, _redirectedReference, _options, containingSourceFile) {
120
+ return moduleNames.map((moduleName, index) => {
91
121
  if (moduleCache.has(moduleName, containingFile)) {
92
122
  return moduleCache.get(moduleName, containingFile);
93
123
  }
94
- const resolvedModule = resolveModuleName(moduleName, containingFile);
124
+ const resolvedModule = resolveModuleName(moduleName, containingFile, containingSourceFile, index);
95
125
  moduleCache.set(moduleName, containingFile, resolvedModule);
96
126
  return resolvedModule;
97
127
  });
98
128
  }
99
- function resolveModuleName(name, containingFile) {
129
+ function resolveModuleName(name, containingFile, containingSourceFile, index) {
130
+ const mode = impliedNodeFormatResolver.resolve(name, index, containingSourceFile, compilerOptions);
100
131
  // Delegate to the TS resolver first.
101
132
  // If that does not bring up anything, try the Astro Module loader
102
133
  // which is able to deal with .astro and other frameworks files.
103
- const tsResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, ts.sys).resolvedModule;
134
+ const tsResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, ts.sys, undefined, undefined, mode).resolvedModule;
104
135
  if (tsResolvedModule && !(0, utils_2.isVirtualFilePath)(tsResolvedModule.resolvedFileName)) {
105
136
  return tsResolvedModule;
106
137
  }
107
- const astroResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, astroSys).resolvedModule;
138
+ const astroResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, astroSys, undefined, undefined, mode).resolvedModule;
108
139
  if (!astroResolvedModule || !(0, utils_2.isVirtualFilePath)(astroResolvedModule.resolvedFileName)) {
109
140
  return astroResolvedModule;
110
141
  }
@@ -69,11 +69,11 @@ export declare class ScriptTagDocumentSnapshot extends FragmentMapper implements
69
69
  scriptTag: TagInformation;
70
70
  private readonly parent;
71
71
  filePath: string;
72
+ readonly scriptKind: ts.ScriptKind;
72
73
  readonly version: number;
73
74
  private text;
74
- scriptKind: ts.ScriptKind;
75
75
  private lineOffsets?;
76
- constructor(scriptTag: TagInformation, parent: AstroDocument, filePath: string);
76
+ constructor(scriptTag: TagInformation, parent: AstroDocument, filePath: string, scriptKind: ts.ScriptKind);
77
77
  positionAt(offset: number): Position;
78
78
  offsetAt(position: Position): number;
79
79
  createFragment(): Promise<SnapshotFragment>;
@@ -73,14 +73,14 @@ class AstroSnapshotFragment {
73
73
  }
74
74
  exports.AstroSnapshotFragment = AstroSnapshotFragment;
75
75
  class ScriptTagDocumentSnapshot extends documents_1.FragmentMapper {
76
- constructor(scriptTag, parent, filePath) {
76
+ constructor(scriptTag, parent, filePath, scriptKind) {
77
77
  super(parent.getText(), scriptTag, filePath);
78
78
  this.scriptTag = scriptTag;
79
79
  this.parent = parent;
80
80
  this.filePath = filePath;
81
+ this.scriptKind = scriptKind;
81
82
  this.version = this.parent.version;
82
83
  this.text = this.parent.getText().slice(this.scriptTag.start, this.scriptTag.end) + '\nexport {}';
83
- this.scriptKind = 1;
84
84
  }
85
85
  positionAt(offset) {
86
86
  return (0, documents_1.positionAt)(offset, this.text, this.getLineOffsets());
@@ -170,12 +170,10 @@ class SnapshotManager {
170
170
  this.globalSnapshotsManager.delete(fileName);
171
171
  }
172
172
  getFileNames() {
173
- return Array.from(this.documents.keys()).map((fileName) => (0, utils_2.toVirtualFilePath)(fileName));
173
+ return Array.from(this.documents.keys());
174
174
  }
175
175
  getProjectFileNames() {
176
- return this.projectFiles.map((file) => {
177
- return (0, utils_2.toVirtualFilePath)(file);
178
- });
176
+ return [...this.projectFiles];
179
177
  }
180
178
  logStatistics() {
181
179
  const date = new Date();
@@ -57,6 +57,7 @@ export declare function toVirtualFilePath(filePath: string): string;
57
57
  export declare function toRealAstroFilePath(filePath: string): string;
58
58
  export declare function ensureRealAstroFilePath(filePath: string): string;
59
59
  export declare function ensureRealFilePath(filePath: string): string;
60
+ export declare function isDocumentSymbolsPath(filePath: string): boolean;
60
61
  /**
61
62
  * Return if a script tag is TypeScript or JavaScript
62
63
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getScriptTagSnapshot = exports.getScriptTagLanguage = exports.ensureRealFilePath = exports.ensureRealAstroFilePath = exports.toRealAstroFilePath = exports.toVirtualFilePath = exports.toVirtualAstroFilePath = exports.isVirtualFilePath = exports.isVirtualSvelteFilePath = exports.isVirtualVueFilePath = exports.isVirtualAstroFilePath = exports.isFrameworkFilePath = exports.isAstroFilePath = exports.isVirtualFrameworkFilePath = exports.getFrameworkFromFilePath = exports.removeAstroComponentSuffix = exports.checkEndOfFileCodeInsert = exports.ensureFrontmatterInsert = exports.convertToLocationRange = exports.convertRange = exports.getScriptKindFromFileName = exports.isSubPath = exports.findTsConfigPath = exports.getExtensionFromScriptKind = exports.getCommitCharactersForScriptElement = exports.scriptElementKindToCompletionItemKind = exports.symbolKindFromString = exports.getSemanticTokenLegend = void 0;
3
+ exports.getScriptTagSnapshot = exports.getScriptTagLanguage = exports.isDocumentSymbolsPath = exports.ensureRealFilePath = exports.ensureRealAstroFilePath = exports.toRealAstroFilePath = exports.toVirtualFilePath = exports.toVirtualAstroFilePath = exports.isVirtualFilePath = exports.isVirtualSvelteFilePath = exports.isVirtualVueFilePath = exports.isVirtualAstroFilePath = exports.isFrameworkFilePath = exports.isAstroFilePath = exports.isVirtualFrameworkFilePath = exports.getFrameworkFromFilePath = exports.removeAstroComponentSuffix = exports.checkEndOfFileCodeInsert = exports.ensureFrontmatterInsert = exports.convertToLocationRange = exports.convertRange = exports.getScriptKindFromFileName = exports.isSubPath = exports.findTsConfigPath = exports.getExtensionFromScriptKind = exports.getCommitCharactersForScriptElement = exports.scriptElementKindToCompletionItemKind = exports.symbolKindFromString = exports.getSemanticTokenLegend = void 0;
4
4
  const path_1 = require("path");
5
5
  const vscode_languageserver_1 = require("vscode-languageserver");
6
6
  const documents_1 = require("../../core/documents");
@@ -320,6 +320,9 @@ function ensureRealAstroFilePath(filePath) {
320
320
  }
321
321
  exports.ensureRealAstroFilePath = ensureRealAstroFilePath;
322
322
  function ensureRealFilePath(filePath) {
323
+ // For Document Symbols, we need to return a different snapshot, so we append a query param to the file path
324
+ // However, we need this removed when we need to deal with real (as in, real on the filesystem) paths
325
+ filePath = filePath.replace('?documentSymbols', '');
323
326
  if (isVirtualFilePath(filePath)) {
324
327
  let extLen = filePath.endsWith('.tsx') ? 4 : 3;
325
328
  return filePath.slice(0, filePath.length - extLen);
@@ -329,6 +332,10 @@ function ensureRealFilePath(filePath) {
329
332
  }
330
333
  }
331
334
  exports.ensureRealFilePath = ensureRealFilePath;
335
+ function isDocumentSymbolsPath(filePath) {
336
+ return filePath.endsWith('?documentSymbols');
337
+ }
338
+ exports.isDocumentSymbolsPath = isDocumentSymbolsPath;
332
339
  /**
333
340
  * Return if a script tag is TypeScript or JavaScript
334
341
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/language-server",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -13,11 +13,6 @@
13
13
  "bin",
14
14
  "types"
15
15
  ],
16
- "scripts": {
17
- "build": "tsc",
18
- "dev": "astro-scripts dev \"src/**/*.ts\"",
19
- "test": "cross-env TS_NODE_TRANSPILE_ONLY=true mocha --timeout 20000 --require ts-node/register \"test/**/*.ts\" --exclude \"test/**/*.d.ts\""
20
- },
21
16
  "dependencies": {
22
17
  "@vscode/emmet-helper": "^2.8.4",
23
18
  "events": "^3.3.0",
@@ -33,10 +28,11 @@
33
28
  "vscode-uri": "^3.0.3"
34
29
  },
35
30
  "devDependencies": {
36
- "@astrojs/svelte": "^0.5.0",
37
- "@astrojs/vue": "^0.5.0",
31
+ "@astrojs/svelte": "^1.0.0",
32
+ "@astrojs/vue": "^1.0.0",
38
33
  "@types/chai": "^4.3.0",
39
34
  "@types/mocha": "^9.1.0",
35
+ "@types/node": "^16.11.58",
40
36
  "@types/prettier": "^2.7.0",
41
37
  "@types/sinon": "^10.0.11",
42
38
  "astro": "^1.1.3",
@@ -47,7 +43,12 @@
47
43
  "sinon": "^13.0.1",
48
44
  "svelte": "^3.49.0",
49
45
  "ts-node": "^10.7.0",
50
- "vue": "^3.2.37",
51
- "typescript": "~4.8.2"
46
+ "typescript": "~4.8.2",
47
+ "vue": "^3.2.37"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc --project tsconfig.build.json",
51
+ "dev": "astro-scripts dev \"src/**/*.ts\"",
52
+ "test": "cross-env TS_NODE_TRANSPILE_ONLY=true mocha --timeout 20000 --require ts-node/register \"test/**/*.ts\" --exclude \"test/**/*.d.ts\""
52
53
  }
53
- }
54
+ }
package/CHANGELOG.md DELETED
@@ -1,520 +0,0 @@
1
- # @astrojs/language-server
2
-
3
- ## 0.24.0
4
-
5
- ### Minor Changes
6
-
7
- - b66ae70: Update the VS Code extension to use a bundled version of the language server for better performance and compatibility with running the extension in the web
8
- - 5a583d3: TypeScript will now be loaded from VS Code / the workspace instead of being bundled inside the language server
9
-
10
- ### Patch Changes
11
-
12
- - 5146422: Fix <> inside the frontmatter preventing certain HTML features from working inside the template
13
-
14
- ## 0.23.3
15
-
16
- ### Patch Changes
17
-
18
- - 150946c: Publish failed
19
-
20
- ## 0.23.2
21
-
22
- ### Patch Changes
23
-
24
- - b13fb51: Don't use `workspace/configuration` on clients that don't support it
25
-
26
- ## 0.23.1
27
-
28
- ### Patch Changes
29
-
30
- - 422376e: Load settings from the Prettier VS Code extension when available
31
-
32
- ## 0.23.0
33
-
34
- ### Minor Changes
35
-
36
- - 1dcef68: Automatically type `Astro.props` using the Props interface when available
37
-
38
- ### Patch Changes
39
-
40
- - b6c95f2: Fix completions for HTML attributes not working anymore since 0.20.3
41
-
42
- ## 0.22.0
43
-
44
- ### Minor Changes
45
-
46
- - d5aafc0: Formatting is now powered by Prettier and our Prettier plugin. Going forward, this should result in a more stable and complete way of formatting Astro files
47
-
48
- ### Patch Changes
49
-
50
- - 61620f1: Add support for Go To Type Definition
51
- - 9337f00: Fix language server not working when no initlizationOptions were passed
52
-
53
- ## 0.21.1
54
-
55
- ### Patch Changes
56
-
57
- - 0e9d7d0: Improve error handling in cases where we can't load types from the user's project and when the project isn't at the root of the folder
58
- - 3f79dbf: Fix `tsconfig.json` not loading properly in certain contexts on Windows
59
-
60
- ## 0.21.0
61
-
62
- ### Minor Changes
63
-
64
- - 574b75d: Remove support for the Markdown component
65
- - d23ba22: Changed how Astro's types are consumed to avoid making type acquisition explicit inside Astro files
66
-
67
- ### Patch Changes
68
-
69
- - 81f3aa5: Added a debug command to show the currently opened document's TSX output
70
-
71
- ## 0.20.3
72
-
73
- ### Patch Changes
74
-
75
- - 081cf24: Fix completions not working inside script tags, fix duplicate completions in some cases, added completions for the slot element
76
-
77
- ## 0.20.1
78
-
79
- ### Patch Changes
80
-
81
- - e6996f5: Fixed many situations where the language server would warn abusively about not being able to find Astro
82
- - 4589c2b: Fix the language server not warning properly when a package is implicitely any due to missing types
83
-
84
- ## 0.20.0
85
-
86
- ### Minor Changes
87
-
88
- - ba0fab1: Load language integrations from the user's project instead of bundling them in the language server
89
-
90
- ### Patch Changes
91
-
92
- - fa3f0f7: Updated exports for `astro check`
93
-
94
- ## 0.19.6
95
-
96
- ### Patch Changes
97
-
98
- - 4c1045d: Empty changeset because publish failed
99
-
100
- ## 0.19.5
101
-
102
- ### Patch Changes
103
-
104
- - 421ab52: Added a new setting (`astro.typescript.allowArbitraryAttributes`) to enable support for arbitrary attributes
105
- - 06e3c95: Updated behaviour when no settings are provided. All features are now considered enabled by default
106
- - 301dcfb: Remove Lodash from the code base, significally reducing the file count of the package
107
- - dd1283b: Updated Component detection so completions now work for namespaced components (for example, typing `<myMarkdown.` will now give you a completion for the Content component)
108
-
109
- ## 0.19.4
110
-
111
- ### Patch Changes
112
-
113
- - 1033856: Enable support for TypeScript inside hoisted script tags
114
-
115
- ## 0.19.3
116
-
117
- ### Patch Changes
118
-
119
- - 49ff4ef: Fixed more bugs where nonexistent server settings would result in a crash
120
- - 14cbf05: Fix frontmatter completion not working when three dashes were already present
121
-
122
- ## 0.19.2
123
-
124
- ### Patch Changes
125
-
126
- - 7de4967: Add better error messages for Vue and Svelte components with syntax errors
127
- - Updated dependencies [7de4967]
128
- - @astrojs/svelte-language-integration@0.1.6
129
- - @astrojs/vue-language-integration@0.1.1
130
-
131
- ## 0.19.1
132
-
133
- ### Patch Changes
134
-
135
- - 729dff5: Add support for giving linked editing ranges
136
- - 05a48c2: Fix some TypeScript diagnostics not showing up in certain cases
137
- - fe2d26b: Add support for showing Svelte components documentation on hover
138
- - Updated dependencies [fe2d26b]
139
- - @astrojs/svelte-language-integration@0.1.5
140
-
141
- ## 0.19.0
142
-
143
- ### Minor Changes
144
-
145
- - a97b9a4: Add support for Inlay Hints. Minimum VS Code version supported starting from this update is 1.67.0 (April 2022)
146
-
147
- ## 0.18.1
148
-
149
- ### Patch Changes
150
-
151
- - 666739a: Revert update to latest LSP and inlay hints support
152
-
153
- ## 0.18.0
154
-
155
- ### Minor Changes
156
-
157
- - d3c6fd8: Add support for formatting
158
- - 09e1163: Updated language server to latest version of LSP, added support for Inlay Hints
159
- - fcaba8e: Add support for completions and type checking for Vue props
160
-
161
- ### Patch Changes
162
-
163
- - 4138005: Fix frontmatter folding not working properly when last few lines of frontmatter are empty
164
- - 76ff46a: Add `?` in the label of completions of optional parameters (including component props)
165
-
166
- ## 0.17.0
167
-
168
- ### Minor Changes
169
-
170
- - 3ad0f65: Add support for TypeScript features inside script tags (completions, diagnostics, hover etc)
171
-
172
- ### Patch Changes
173
-
174
- - 2e9da14: Add support for loading props completions from .d.ts files, improve performance of props completions
175
-
176
- ## 0.16.1
177
-
178
- ### Patch Changes
179
-
180
- - ad5a5e5: Fix misc issues with Go To Definition
181
- - 1bd790d: Updates config management, make sure to respect TypeScript settings when doing completions and quickfixes
182
-
183
- ## 0.16.0
184
-
185
- ### Minor Changes
186
-
187
- - 9abff62: Add support for code actions
188
-
189
- ### Patch Changes
190
-
191
- - b485acd: Fixed bug where nonexistent server settings would result in a crash
192
- - 1cff04c: Fix Emmet settings not being loaded, add support for Emmet in CSS
193
- - 1bcae45: Remove support for Node 12 (VS Code versions under 1.56)
194
- - c8d81a1: Update directives tooltips, add missing `is:raw`
195
- - Updated dependencies [1bcae45]
196
- - @astrojs/svelte-language-integration@0.1.4
197
-
198
- ## 0.15.0
199
-
200
- ### Minor Changes
201
-
202
- - 6bb45cb: Overhaul TypeScript completions
203
-
204
- - Add support for completions inside expressions
205
- - Add support for auto imports on completion
206
- - Fix misc issues in completions (missing description, deprecated stuff not showing as deprecated)
207
-
208
- ### Patch Changes
209
-
210
- - 7978de1: Add support for folding JavaScript
211
- - 3ac74bc: Improve props completions on components
212
- - Updated dependencies [6bb45cb]
213
- - @astrojs/svelte-language-integration@0.1.3
214
-
215
- ## 0.14.0
216
-
217
- ### Minor Changes
218
-
219
- - 9118c46: Add support for loading type definitions from Astro itself
220
-
221
- ### Patch Changes
222
-
223
- - 9ea5b97: Make TypeScript ignore content of Markdown tags
224
- - dbf624a: Fix error when returning a response from the frontmatter
225
-
226
- ## 0.13.4
227
-
228
- ### Patch Changes
229
-
230
- - 5874655: Add support for Astro 0.26.0 attributes
231
-
232
- ## 0.13.3
233
-
234
- ### Patch Changes
235
-
236
- - 1fb21ff: Add support for folding CSS
237
- - 99d7536: Add support for semantic tokens
238
- - b363c00: Improve completions for components
239
-
240
- ## 0.13.2
241
-
242
- ### Patch Changes
243
-
244
- - aff8b76: Fix error caused by malformed Svelte components
245
- - Updated dependencies [aff8b76]
246
- - @astrojs/svelte-language-integration@0.1.2
247
-
248
- ## 0.13.1
249
-
250
- ### Patch Changes
251
-
252
- - ea74fdb: Publish failed
253
-
254
- ## 0.13.0
255
-
256
- ### Minor Changes
257
-
258
- - 82b8891: Add HTML hover info, fix Astro directives producing errors, fix missing children property for JSX based frameworks
259
-
260
- ### Patch Changes
261
-
262
- - 9f4f907: Add CSS hover info
263
- - c09116f: Add support for Document Symbols (Outline tab, breadcrumb navigation)
264
-
265
- ## 0.12.1
266
-
267
- ### Patch Changes
268
-
269
- - 49955c6: Add support for colors indicators and color picker
270
-
271
- ## 0.12.0
272
-
273
- ### Minor Changes
274
-
275
- - 8a58a56: Refactor the language-server, fixes many issues related to imports, add support for completions in multiple style tags
276
-
277
- ## 0.11.0
278
-
279
- ### Minor Changes
280
-
281
- - fd92a85: Add support for loading files from non-JSX frameworks such as Vue and Svelte
282
-
283
- ### Patch Changes
284
-
285
- - d056cd5: Fixes production bugs in extension
286
-
287
- ## 0.9.3
288
-
289
- ### Patch Changes
290
-
291
- - c4d43b4: Deploy to OpenVSX
292
-
293
- ## 0.9.2
294
-
295
- ### Patch Changes
296
-
297
- - 91404d1: Enable publishing to OpenVSX
298
-
299
- ## 0.9.1
300
-
301
- ### Patch Changes
302
-
303
- - 7dc85cc: Add support for Emmet inside components, upgrade Emmet version
304
-
305
- ## 0.9.0
306
-
307
- ### Minor Changes
308
-
309
- - 6b6b47a: Remove internal astro.d.ts files, instead prefer the one provided by Astro itself
310
-
311
- ## 0.8.10
312
-
313
- ### Patch Changes
314
-
315
- - 5b16fb4: Fix errors showing on wrong line due to an error in TSX generation
316
-
317
- ## 0.8.9
318
-
319
- ### Patch Changes
320
-
321
- - d0485a2: Only apply content transformations for TSX generation in relevant places
322
-
323
- ## 0.8.8
324
-
325
- ### Patch Changes
326
-
327
- - 526d5c7: Bring back loading the user js/tsconfig.json, notably, this allow us to support aliases
328
-
329
- ## 0.8.7
330
-
331
- ### Patch Changes
332
-
333
- - 897ab35: Provide vite client types to Astro files
334
-
335
- ## 0.8.6
336
-
337
- ### Patch Changes
338
-
339
- - 97559b6: Removes errors with import.meta.hot
340
- - 4c93d24: Prevent reading tsconfig in .astro files
341
-
342
- ## 0.8.5
343
-
344
- ### Patch Changes
345
-
346
- - f1f3091: Fix commenting, namespaced elements, and Fragment typings
347
-
348
- ## 0.8.4
349
-
350
- ### Patch Changes
351
-
352
- - 481e009: Add Node v12 support, testing
353
-
354
- ## 0.8.3
355
-
356
- ### Patch Changes
357
-
358
- - fef3091: Updates `typescript` from 4.5.1-rc to 4.5.2 (stable)
359
-
360
- ## 0.8.2
361
-
362
- ### Patch Changes
363
-
364
- - 528c6bd: Adds missing dependencies
365
-
366
- ## 0.8.1
367
-
368
- ### Patch Changes
369
-
370
- - b20db6e: Bump TypeScript from 4.3.1-rc to 4.5.1-rc
371
-
372
- ## 0.7.19
373
-
374
- ### Patch Changes
375
-
376
- - 2910b03: Add support for at-prefixed attributes
377
-
378
- ## 0.7.18
379
-
380
- ### Patch Changes
381
-
382
- - 12b4ed3: Adds support for Astro.slots typing
383
-
384
- ## 0.7.17
385
-
386
- ### Patch Changes
387
-
388
- - 7c6f6a6: Fixes issue with errors not going away after fixing them
389
-
390
- ## 0.7.16
391
-
392
- ### Patch Changes
393
-
394
- - b6f44d4: Change hover text to display HTML attribute instead of JSX
395
- - 4166283: Prevents errors when using the Fragment component
396
-
397
- ## 0.7.15
398
-
399
- ### Patch Changes
400
-
401
- - 6340a79: Adds dts files for using the language server programmatically
402
-
403
- ## 0.7.14
404
-
405
- ### Patch Changes
406
-
407
- - e0facf6: Adds an AstroCheck export, to allow running diagnostics programmatically
408
- - 3c903c3: Add DiagnosticSeverity as an export
409
- - b0a8bc1: Added Rename Symbol capability
410
-
411
- ## 0.7.13
412
-
413
- ### Patch Changes
414
-
415
- - 1b2afc7: Prevents presence of @types/react from causing false-positive astro errors
416
-
417
- ## 0.7.12
418
-
419
- ### Patch Changes
420
-
421
- - 553969e: Fixes errors when using a tsconfig.json
422
-
423
- Previously when using a tsconfig.json that had an `include` property, that property would cause diagnostics in astro files to show JSX related errors. This fixes that issue.
424
-
425
- - b4c1b70: Fixes diagnostic false-positives with comments wrapping HTML
426
-
427
- ## 0.7.11
428
-
429
- ### Patch Changes
430
-
431
- - 02bcb91: Prevents false-positive errors when lots of comments are used
432
-
433
- ## 0.7.10
434
-
435
- ### Patch Changes
436
-
437
- - 1958d51: Default Astro.fetchContent to treat type param as any
438
- - f558e54: When no Props interface is provide, treat as any
439
-
440
- ## 0.7.9
441
-
442
- ### Patch Changes
443
-
444
- - 6c952ae: Fixes diagnostic issues with omitting semicolons in the frontmatter section
445
-
446
- ## 0.7.8
447
-
448
- ### Patch Changes
449
-
450
- - f2f7fc8: Removes errors shown when using Astro.resolve
451
-
452
- ## 0.7.7
453
-
454
- ### Patch Changes
455
-
456
- - 6501757: Fixes false-positive errors on importing images
457
-
458
- ## 0.7.6
459
-
460
- ### Patch Changes
461
-
462
- - ea2d56d: Bump version to fix unpublished version in npm
463
-
464
- ## 0.7.4
465
-
466
- ### Patch Changes
467
-
468
- - 6604c9f: Fixes diagnostic false-positive caused by doctype
469
-
470
- ## 0.7.3
471
-
472
- ### Patch Changes
473
-
474
- - 8f7bd34: Fixes false-positive error when using blockquotes within Markdown component
475
-
476
- ## 0.7.2
477
-
478
- ### Patch Changes
479
-
480
- - 1b3a832: Adds diagnostics (errors and warnings)
481
-
482
- ## 0.7.1
483
-
484
- ### Patch Changes
485
-
486
- - 7874c06: Improves completion performance
487
-
488
- Completion performance is improved by fixing a bug where we were giving the TypeScript compiler API the wrong name of files, causing it to search for files for a long time.
489
-
490
- ## 0.7.0
491
-
492
- ### Minor Changes
493
-
494
- - 72d3ff0: Adds support for prop completion from ts/jsx files
495
-
496
- ## 0.6.0
497
-
498
- - Fixes bug with signature help not appear in the component script section.
499
- - Adds completion suggestions for Astro.\* APIs in the component script.
500
- - Adds support for Hover based hints in the component script section.
501
- - Fixes bug with Go to Definition (cmd + click) of Components.
502
-
503
- ## 0.5.0
504
-
505
- - Fix `bin` file
506
-
507
- ## 0.5.0-next.1
508
-
509
- - Expose `bin/server.js` as `astro-ls`
510
-
511
- ## 0.5.0-next.0
512
-
513
- - Moved to scoped `@astrojs/language-server` package
514
- - Removed some `devDependencies` from the bundle and added them to `dependencies`
515
-
516
- ## 0.4.0
517
-
518
- ### Minor Changes
519
-
520
- - 06e2597: Adds support for import suggestions