@astrojs/language-server 0.24.1 → 0.26.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.
- package/dist/check.d.ts +1 -2
- package/dist/check.js +5 -5
- package/dist/plugins/astro/features/CompletionsProvider.js +1 -1
- package/dist/plugins/typescript/TypeScriptPlugin.js +1 -1
- package/dist/plugins/typescript/features/CodeActionsProvider.js +4 -4
- package/dist/plugins/typescript/features/CompletionsProvider.js +1 -1
- package/dist/plugins/typescript/features/DefinitionsProvider.js +3 -4
- package/dist/plugins/typescript/features/DiagnosticsProvider.js +4 -5
- package/dist/plugins/typescript/features/DocumentSymbolsProvider.js +1 -1
- package/dist/plugins/typescript/features/FoldingRangesProvider.js +1 -2
- package/dist/plugins/typescript/features/HoverProvider.js +1 -2
- package/dist/plugins/typescript/features/InlayHintsProvider.js +1 -3
- package/dist/plugins/typescript/features/SemanticTokenProvider.js +1 -3
- package/dist/plugins/typescript/features/SignatureHelpProvider.js +1 -2
- package/dist/plugins/typescript/features/TypeDefinitionsProvider.js +3 -4
- package/dist/plugins/typescript/language-service.js +30 -16
- package/dist/plugins/typescript/module-loader.d.ts +1 -1
- package/dist/plugins/typescript/module-loader.js +37 -6
- package/dist/plugins/typescript/snapshots/DocumentSnapshot.d.ts +2 -2
- package/dist/plugins/typescript/snapshots/DocumentSnapshot.js +2 -2
- package/dist/plugins/typescript/snapshots/SnapshotManager.js +2 -4
- package/dist/plugins/typescript/utils.d.ts +1 -0
- package/dist/plugins/typescript/utils.js +8 -1
- package/package.json +13 -12
- package/CHANGELOG.md +0 -526
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
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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 =
|
|
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(
|
|
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 ??
|
|
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 =
|
|
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 =
|
|
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 ?
|
|
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(
|
|
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(
|
|
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
|
|
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 ?
|
|
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(
|
|
36
|
+
typeDefs = lang.getTypeDefinitionAtPosition(tsDoc.filePath, fragmentOffset);
|
|
38
37
|
}
|
|
39
38
|
const docs = new utils_3.SnapshotFragmentMap(this.languageServiceManager);
|
|
40
|
-
docs.set(
|
|
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
|
-
|
|
181
|
-
let doc = snapshotManager.get(
|
|
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(
|
|
186
|
-
doc = DocumentSnapshotUtils.createFromFilePath(
|
|
187
|
-
snapshotManager.set(
|
|
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)(
|
|
196
|
+
if ((0, utils_2.isAstroFilePath)(realFileName)) {
|
|
190
197
|
const document = doc.parent;
|
|
191
|
-
const scriptTagSnapshots = createScriptTagsSnapshots(
|
|
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: '
|
|
248
|
-
{ extension: '
|
|
249
|
-
{ extension: '
|
|
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())
|
|
173
|
+
return Array.from(this.documents.keys());
|
|
174
174
|
}
|
|
175
175
|
getProjectFileNames() {
|
|
176
|
-
return this.projectFiles
|
|
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.
|
|
3
|
+
"version": "0.26.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,21 +28,27 @@
|
|
|
33
28
|
"vscode-uri": "^3.0.3"
|
|
34
29
|
},
|
|
35
30
|
"devDependencies": {
|
|
36
|
-
"@astrojs/svelte": "^0.
|
|
37
|
-
"@astrojs/vue": "^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",
|
|
43
|
-
"astro-scripts": "
|
|
39
|
+
"astro-scripts": "*",
|
|
44
40
|
"chai": "^4.3.6",
|
|
45
41
|
"cross-env": "^7.0.3",
|
|
46
42
|
"mocha": "^9.2.2",
|
|
47
43
|
"sinon": "^13.0.1",
|
|
48
44
|
"svelte": "^3.49.0",
|
|
49
45
|
"ts-node": "^10.7.0",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
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,526 +0,0 @@
|
|
|
1
|
-
# @astrojs/language-server
|
|
2
|
-
|
|
3
|
-
## 0.24.1
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 180ade5: Empty changeset for failed publish
|
|
8
|
-
|
|
9
|
-
## 0.24.0
|
|
10
|
-
|
|
11
|
-
### Minor Changes
|
|
12
|
-
|
|
13
|
-
- 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
|
|
14
|
-
- 5a583d3: TypeScript will now be loaded from VS Code / the workspace instead of being bundled inside the language server
|
|
15
|
-
|
|
16
|
-
### Patch Changes
|
|
17
|
-
|
|
18
|
-
- 5146422: Fix <> inside the frontmatter preventing certain HTML features from working inside the template
|
|
19
|
-
|
|
20
|
-
## 0.23.3
|
|
21
|
-
|
|
22
|
-
### Patch Changes
|
|
23
|
-
|
|
24
|
-
- 150946c: Publish failed
|
|
25
|
-
|
|
26
|
-
## 0.23.2
|
|
27
|
-
|
|
28
|
-
### Patch Changes
|
|
29
|
-
|
|
30
|
-
- b13fb51: Don't use `workspace/configuration` on clients that don't support it
|
|
31
|
-
|
|
32
|
-
## 0.23.1
|
|
33
|
-
|
|
34
|
-
### Patch Changes
|
|
35
|
-
|
|
36
|
-
- 422376e: Load settings from the Prettier VS Code extension when available
|
|
37
|
-
|
|
38
|
-
## 0.23.0
|
|
39
|
-
|
|
40
|
-
### Minor Changes
|
|
41
|
-
|
|
42
|
-
- 1dcef68: Automatically type `Astro.props` using the Props interface when available
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- b6c95f2: Fix completions for HTML attributes not working anymore since 0.20.3
|
|
47
|
-
|
|
48
|
-
## 0.22.0
|
|
49
|
-
|
|
50
|
-
### Minor Changes
|
|
51
|
-
|
|
52
|
-
- 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
|
|
53
|
-
|
|
54
|
-
### Patch Changes
|
|
55
|
-
|
|
56
|
-
- 61620f1: Add support for Go To Type Definition
|
|
57
|
-
- 9337f00: Fix language server not working when no initlizationOptions were passed
|
|
58
|
-
|
|
59
|
-
## 0.21.1
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- 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
|
|
64
|
-
- 3f79dbf: Fix `tsconfig.json` not loading properly in certain contexts on Windows
|
|
65
|
-
|
|
66
|
-
## 0.21.0
|
|
67
|
-
|
|
68
|
-
### Minor Changes
|
|
69
|
-
|
|
70
|
-
- 574b75d: Remove support for the Markdown component
|
|
71
|
-
- d23ba22: Changed how Astro's types are consumed to avoid making type acquisition explicit inside Astro files
|
|
72
|
-
|
|
73
|
-
### Patch Changes
|
|
74
|
-
|
|
75
|
-
- 81f3aa5: Added a debug command to show the currently opened document's TSX output
|
|
76
|
-
|
|
77
|
-
## 0.20.3
|
|
78
|
-
|
|
79
|
-
### Patch Changes
|
|
80
|
-
|
|
81
|
-
- 081cf24: Fix completions not working inside script tags, fix duplicate completions in some cases, added completions for the slot element
|
|
82
|
-
|
|
83
|
-
## 0.20.1
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- e6996f5: Fixed many situations where the language server would warn abusively about not being able to find Astro
|
|
88
|
-
- 4589c2b: Fix the language server not warning properly when a package is implicitely any due to missing types
|
|
89
|
-
|
|
90
|
-
## 0.20.0
|
|
91
|
-
|
|
92
|
-
### Minor Changes
|
|
93
|
-
|
|
94
|
-
- ba0fab1: Load language integrations from the user's project instead of bundling them in the language server
|
|
95
|
-
|
|
96
|
-
### Patch Changes
|
|
97
|
-
|
|
98
|
-
- fa3f0f7: Updated exports for `astro check`
|
|
99
|
-
|
|
100
|
-
## 0.19.6
|
|
101
|
-
|
|
102
|
-
### Patch Changes
|
|
103
|
-
|
|
104
|
-
- 4c1045d: Empty changeset because publish failed
|
|
105
|
-
|
|
106
|
-
## 0.19.5
|
|
107
|
-
|
|
108
|
-
### Patch Changes
|
|
109
|
-
|
|
110
|
-
- 421ab52: Added a new setting (`astro.typescript.allowArbitraryAttributes`) to enable support for arbitrary attributes
|
|
111
|
-
- 06e3c95: Updated behaviour when no settings are provided. All features are now considered enabled by default
|
|
112
|
-
- 301dcfb: Remove Lodash from the code base, significally reducing the file count of the package
|
|
113
|
-
- 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)
|
|
114
|
-
|
|
115
|
-
## 0.19.4
|
|
116
|
-
|
|
117
|
-
### Patch Changes
|
|
118
|
-
|
|
119
|
-
- 1033856: Enable support for TypeScript inside hoisted script tags
|
|
120
|
-
|
|
121
|
-
## 0.19.3
|
|
122
|
-
|
|
123
|
-
### Patch Changes
|
|
124
|
-
|
|
125
|
-
- 49ff4ef: Fixed more bugs where nonexistent server settings would result in a crash
|
|
126
|
-
- 14cbf05: Fix frontmatter completion not working when three dashes were already present
|
|
127
|
-
|
|
128
|
-
## 0.19.2
|
|
129
|
-
|
|
130
|
-
### Patch Changes
|
|
131
|
-
|
|
132
|
-
- 7de4967: Add better error messages for Vue and Svelte components with syntax errors
|
|
133
|
-
- Updated dependencies [7de4967]
|
|
134
|
-
- @astrojs/svelte-language-integration@0.1.6
|
|
135
|
-
- @astrojs/vue-language-integration@0.1.1
|
|
136
|
-
|
|
137
|
-
## 0.19.1
|
|
138
|
-
|
|
139
|
-
### Patch Changes
|
|
140
|
-
|
|
141
|
-
- 729dff5: Add support for giving linked editing ranges
|
|
142
|
-
- 05a48c2: Fix some TypeScript diagnostics not showing up in certain cases
|
|
143
|
-
- fe2d26b: Add support for showing Svelte components documentation on hover
|
|
144
|
-
- Updated dependencies [fe2d26b]
|
|
145
|
-
- @astrojs/svelte-language-integration@0.1.5
|
|
146
|
-
|
|
147
|
-
## 0.19.0
|
|
148
|
-
|
|
149
|
-
### Minor Changes
|
|
150
|
-
|
|
151
|
-
- a97b9a4: Add support for Inlay Hints. Minimum VS Code version supported starting from this update is 1.67.0 (April 2022)
|
|
152
|
-
|
|
153
|
-
## 0.18.1
|
|
154
|
-
|
|
155
|
-
### Patch Changes
|
|
156
|
-
|
|
157
|
-
- 666739a: Revert update to latest LSP and inlay hints support
|
|
158
|
-
|
|
159
|
-
## 0.18.0
|
|
160
|
-
|
|
161
|
-
### Minor Changes
|
|
162
|
-
|
|
163
|
-
- d3c6fd8: Add support for formatting
|
|
164
|
-
- 09e1163: Updated language server to latest version of LSP, added support for Inlay Hints
|
|
165
|
-
- fcaba8e: Add support for completions and type checking for Vue props
|
|
166
|
-
|
|
167
|
-
### Patch Changes
|
|
168
|
-
|
|
169
|
-
- 4138005: Fix frontmatter folding not working properly when last few lines of frontmatter are empty
|
|
170
|
-
- 76ff46a: Add `?` in the label of completions of optional parameters (including component props)
|
|
171
|
-
|
|
172
|
-
## 0.17.0
|
|
173
|
-
|
|
174
|
-
### Minor Changes
|
|
175
|
-
|
|
176
|
-
- 3ad0f65: Add support for TypeScript features inside script tags (completions, diagnostics, hover etc)
|
|
177
|
-
|
|
178
|
-
### Patch Changes
|
|
179
|
-
|
|
180
|
-
- 2e9da14: Add support for loading props completions from .d.ts files, improve performance of props completions
|
|
181
|
-
|
|
182
|
-
## 0.16.1
|
|
183
|
-
|
|
184
|
-
### Patch Changes
|
|
185
|
-
|
|
186
|
-
- ad5a5e5: Fix misc issues with Go To Definition
|
|
187
|
-
- 1bd790d: Updates config management, make sure to respect TypeScript settings when doing completions and quickfixes
|
|
188
|
-
|
|
189
|
-
## 0.16.0
|
|
190
|
-
|
|
191
|
-
### Minor Changes
|
|
192
|
-
|
|
193
|
-
- 9abff62: Add support for code actions
|
|
194
|
-
|
|
195
|
-
### Patch Changes
|
|
196
|
-
|
|
197
|
-
- b485acd: Fixed bug where nonexistent server settings would result in a crash
|
|
198
|
-
- 1cff04c: Fix Emmet settings not being loaded, add support for Emmet in CSS
|
|
199
|
-
- 1bcae45: Remove support for Node 12 (VS Code versions under 1.56)
|
|
200
|
-
- c8d81a1: Update directives tooltips, add missing `is:raw`
|
|
201
|
-
- Updated dependencies [1bcae45]
|
|
202
|
-
- @astrojs/svelte-language-integration@0.1.4
|
|
203
|
-
|
|
204
|
-
## 0.15.0
|
|
205
|
-
|
|
206
|
-
### Minor Changes
|
|
207
|
-
|
|
208
|
-
- 6bb45cb: Overhaul TypeScript completions
|
|
209
|
-
|
|
210
|
-
- Add support for completions inside expressions
|
|
211
|
-
- Add support for auto imports on completion
|
|
212
|
-
- Fix misc issues in completions (missing description, deprecated stuff not showing as deprecated)
|
|
213
|
-
|
|
214
|
-
### Patch Changes
|
|
215
|
-
|
|
216
|
-
- 7978de1: Add support for folding JavaScript
|
|
217
|
-
- 3ac74bc: Improve props completions on components
|
|
218
|
-
- Updated dependencies [6bb45cb]
|
|
219
|
-
- @astrojs/svelte-language-integration@0.1.3
|
|
220
|
-
|
|
221
|
-
## 0.14.0
|
|
222
|
-
|
|
223
|
-
### Minor Changes
|
|
224
|
-
|
|
225
|
-
- 9118c46: Add support for loading type definitions from Astro itself
|
|
226
|
-
|
|
227
|
-
### Patch Changes
|
|
228
|
-
|
|
229
|
-
- 9ea5b97: Make TypeScript ignore content of Markdown tags
|
|
230
|
-
- dbf624a: Fix error when returning a response from the frontmatter
|
|
231
|
-
|
|
232
|
-
## 0.13.4
|
|
233
|
-
|
|
234
|
-
### Patch Changes
|
|
235
|
-
|
|
236
|
-
- 5874655: Add support for Astro 0.26.0 attributes
|
|
237
|
-
|
|
238
|
-
## 0.13.3
|
|
239
|
-
|
|
240
|
-
### Patch Changes
|
|
241
|
-
|
|
242
|
-
- 1fb21ff: Add support for folding CSS
|
|
243
|
-
- 99d7536: Add support for semantic tokens
|
|
244
|
-
- b363c00: Improve completions for components
|
|
245
|
-
|
|
246
|
-
## 0.13.2
|
|
247
|
-
|
|
248
|
-
### Patch Changes
|
|
249
|
-
|
|
250
|
-
- aff8b76: Fix error caused by malformed Svelte components
|
|
251
|
-
- Updated dependencies [aff8b76]
|
|
252
|
-
- @astrojs/svelte-language-integration@0.1.2
|
|
253
|
-
|
|
254
|
-
## 0.13.1
|
|
255
|
-
|
|
256
|
-
### Patch Changes
|
|
257
|
-
|
|
258
|
-
- ea74fdb: Publish failed
|
|
259
|
-
|
|
260
|
-
## 0.13.0
|
|
261
|
-
|
|
262
|
-
### Minor Changes
|
|
263
|
-
|
|
264
|
-
- 82b8891: Add HTML hover info, fix Astro directives producing errors, fix missing children property for JSX based frameworks
|
|
265
|
-
|
|
266
|
-
### Patch Changes
|
|
267
|
-
|
|
268
|
-
- 9f4f907: Add CSS hover info
|
|
269
|
-
- c09116f: Add support for Document Symbols (Outline tab, breadcrumb navigation)
|
|
270
|
-
|
|
271
|
-
## 0.12.1
|
|
272
|
-
|
|
273
|
-
### Patch Changes
|
|
274
|
-
|
|
275
|
-
- 49955c6: Add support for colors indicators and color picker
|
|
276
|
-
|
|
277
|
-
## 0.12.0
|
|
278
|
-
|
|
279
|
-
### Minor Changes
|
|
280
|
-
|
|
281
|
-
- 8a58a56: Refactor the language-server, fixes many issues related to imports, add support for completions in multiple style tags
|
|
282
|
-
|
|
283
|
-
## 0.11.0
|
|
284
|
-
|
|
285
|
-
### Minor Changes
|
|
286
|
-
|
|
287
|
-
- fd92a85: Add support for loading files from non-JSX frameworks such as Vue and Svelte
|
|
288
|
-
|
|
289
|
-
### Patch Changes
|
|
290
|
-
|
|
291
|
-
- d056cd5: Fixes production bugs in extension
|
|
292
|
-
|
|
293
|
-
## 0.9.3
|
|
294
|
-
|
|
295
|
-
### Patch Changes
|
|
296
|
-
|
|
297
|
-
- c4d43b4: Deploy to OpenVSX
|
|
298
|
-
|
|
299
|
-
## 0.9.2
|
|
300
|
-
|
|
301
|
-
### Patch Changes
|
|
302
|
-
|
|
303
|
-
- 91404d1: Enable publishing to OpenVSX
|
|
304
|
-
|
|
305
|
-
## 0.9.1
|
|
306
|
-
|
|
307
|
-
### Patch Changes
|
|
308
|
-
|
|
309
|
-
- 7dc85cc: Add support for Emmet inside components, upgrade Emmet version
|
|
310
|
-
|
|
311
|
-
## 0.9.0
|
|
312
|
-
|
|
313
|
-
### Minor Changes
|
|
314
|
-
|
|
315
|
-
- 6b6b47a: Remove internal astro.d.ts files, instead prefer the one provided by Astro itself
|
|
316
|
-
|
|
317
|
-
## 0.8.10
|
|
318
|
-
|
|
319
|
-
### Patch Changes
|
|
320
|
-
|
|
321
|
-
- 5b16fb4: Fix errors showing on wrong line due to an error in TSX generation
|
|
322
|
-
|
|
323
|
-
## 0.8.9
|
|
324
|
-
|
|
325
|
-
### Patch Changes
|
|
326
|
-
|
|
327
|
-
- d0485a2: Only apply content transformations for TSX generation in relevant places
|
|
328
|
-
|
|
329
|
-
## 0.8.8
|
|
330
|
-
|
|
331
|
-
### Patch Changes
|
|
332
|
-
|
|
333
|
-
- 526d5c7: Bring back loading the user js/tsconfig.json, notably, this allow us to support aliases
|
|
334
|
-
|
|
335
|
-
## 0.8.7
|
|
336
|
-
|
|
337
|
-
### Patch Changes
|
|
338
|
-
|
|
339
|
-
- 897ab35: Provide vite client types to Astro files
|
|
340
|
-
|
|
341
|
-
## 0.8.6
|
|
342
|
-
|
|
343
|
-
### Patch Changes
|
|
344
|
-
|
|
345
|
-
- 97559b6: Removes errors with import.meta.hot
|
|
346
|
-
- 4c93d24: Prevent reading tsconfig in .astro files
|
|
347
|
-
|
|
348
|
-
## 0.8.5
|
|
349
|
-
|
|
350
|
-
### Patch Changes
|
|
351
|
-
|
|
352
|
-
- f1f3091: Fix commenting, namespaced elements, and Fragment typings
|
|
353
|
-
|
|
354
|
-
## 0.8.4
|
|
355
|
-
|
|
356
|
-
### Patch Changes
|
|
357
|
-
|
|
358
|
-
- 481e009: Add Node v12 support, testing
|
|
359
|
-
|
|
360
|
-
## 0.8.3
|
|
361
|
-
|
|
362
|
-
### Patch Changes
|
|
363
|
-
|
|
364
|
-
- fef3091: Updates `typescript` from 4.5.1-rc to 4.5.2 (stable)
|
|
365
|
-
|
|
366
|
-
## 0.8.2
|
|
367
|
-
|
|
368
|
-
### Patch Changes
|
|
369
|
-
|
|
370
|
-
- 528c6bd: Adds missing dependencies
|
|
371
|
-
|
|
372
|
-
## 0.8.1
|
|
373
|
-
|
|
374
|
-
### Patch Changes
|
|
375
|
-
|
|
376
|
-
- b20db6e: Bump TypeScript from 4.3.1-rc to 4.5.1-rc
|
|
377
|
-
|
|
378
|
-
## 0.7.19
|
|
379
|
-
|
|
380
|
-
### Patch Changes
|
|
381
|
-
|
|
382
|
-
- 2910b03: Add support for at-prefixed attributes
|
|
383
|
-
|
|
384
|
-
## 0.7.18
|
|
385
|
-
|
|
386
|
-
### Patch Changes
|
|
387
|
-
|
|
388
|
-
- 12b4ed3: Adds support for Astro.slots typing
|
|
389
|
-
|
|
390
|
-
## 0.7.17
|
|
391
|
-
|
|
392
|
-
### Patch Changes
|
|
393
|
-
|
|
394
|
-
- 7c6f6a6: Fixes issue with errors not going away after fixing them
|
|
395
|
-
|
|
396
|
-
## 0.7.16
|
|
397
|
-
|
|
398
|
-
### Patch Changes
|
|
399
|
-
|
|
400
|
-
- b6f44d4: Change hover text to display HTML attribute instead of JSX
|
|
401
|
-
- 4166283: Prevents errors when using the Fragment component
|
|
402
|
-
|
|
403
|
-
## 0.7.15
|
|
404
|
-
|
|
405
|
-
### Patch Changes
|
|
406
|
-
|
|
407
|
-
- 6340a79: Adds dts files for using the language server programmatically
|
|
408
|
-
|
|
409
|
-
## 0.7.14
|
|
410
|
-
|
|
411
|
-
### Patch Changes
|
|
412
|
-
|
|
413
|
-
- e0facf6: Adds an AstroCheck export, to allow running diagnostics programmatically
|
|
414
|
-
- 3c903c3: Add DiagnosticSeverity as an export
|
|
415
|
-
- b0a8bc1: Added Rename Symbol capability
|
|
416
|
-
|
|
417
|
-
## 0.7.13
|
|
418
|
-
|
|
419
|
-
### Patch Changes
|
|
420
|
-
|
|
421
|
-
- 1b2afc7: Prevents presence of @types/react from causing false-positive astro errors
|
|
422
|
-
|
|
423
|
-
## 0.7.12
|
|
424
|
-
|
|
425
|
-
### Patch Changes
|
|
426
|
-
|
|
427
|
-
- 553969e: Fixes errors when using a tsconfig.json
|
|
428
|
-
|
|
429
|
-
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.
|
|
430
|
-
|
|
431
|
-
- b4c1b70: Fixes diagnostic false-positives with comments wrapping HTML
|
|
432
|
-
|
|
433
|
-
## 0.7.11
|
|
434
|
-
|
|
435
|
-
### Patch Changes
|
|
436
|
-
|
|
437
|
-
- 02bcb91: Prevents false-positive errors when lots of comments are used
|
|
438
|
-
|
|
439
|
-
## 0.7.10
|
|
440
|
-
|
|
441
|
-
### Patch Changes
|
|
442
|
-
|
|
443
|
-
- 1958d51: Default Astro.fetchContent to treat type param as any
|
|
444
|
-
- f558e54: When no Props interface is provide, treat as any
|
|
445
|
-
|
|
446
|
-
## 0.7.9
|
|
447
|
-
|
|
448
|
-
### Patch Changes
|
|
449
|
-
|
|
450
|
-
- 6c952ae: Fixes diagnostic issues with omitting semicolons in the frontmatter section
|
|
451
|
-
|
|
452
|
-
## 0.7.8
|
|
453
|
-
|
|
454
|
-
### Patch Changes
|
|
455
|
-
|
|
456
|
-
- f2f7fc8: Removes errors shown when using Astro.resolve
|
|
457
|
-
|
|
458
|
-
## 0.7.7
|
|
459
|
-
|
|
460
|
-
### Patch Changes
|
|
461
|
-
|
|
462
|
-
- 6501757: Fixes false-positive errors on importing images
|
|
463
|
-
|
|
464
|
-
## 0.7.6
|
|
465
|
-
|
|
466
|
-
### Patch Changes
|
|
467
|
-
|
|
468
|
-
- ea2d56d: Bump version to fix unpublished version in npm
|
|
469
|
-
|
|
470
|
-
## 0.7.4
|
|
471
|
-
|
|
472
|
-
### Patch Changes
|
|
473
|
-
|
|
474
|
-
- 6604c9f: Fixes diagnostic false-positive caused by doctype
|
|
475
|
-
|
|
476
|
-
## 0.7.3
|
|
477
|
-
|
|
478
|
-
### Patch Changes
|
|
479
|
-
|
|
480
|
-
- 8f7bd34: Fixes false-positive error when using blockquotes within Markdown component
|
|
481
|
-
|
|
482
|
-
## 0.7.2
|
|
483
|
-
|
|
484
|
-
### Patch Changes
|
|
485
|
-
|
|
486
|
-
- 1b3a832: Adds diagnostics (errors and warnings)
|
|
487
|
-
|
|
488
|
-
## 0.7.1
|
|
489
|
-
|
|
490
|
-
### Patch Changes
|
|
491
|
-
|
|
492
|
-
- 7874c06: Improves completion performance
|
|
493
|
-
|
|
494
|
-
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.
|
|
495
|
-
|
|
496
|
-
## 0.7.0
|
|
497
|
-
|
|
498
|
-
### Minor Changes
|
|
499
|
-
|
|
500
|
-
- 72d3ff0: Adds support for prop completion from ts/jsx files
|
|
501
|
-
|
|
502
|
-
## 0.6.0
|
|
503
|
-
|
|
504
|
-
- Fixes bug with signature help not appear in the component script section.
|
|
505
|
-
- Adds completion suggestions for Astro.\* APIs in the component script.
|
|
506
|
-
- Adds support for Hover based hints in the component script section.
|
|
507
|
-
- Fixes bug with Go to Definition (cmd + click) of Components.
|
|
508
|
-
|
|
509
|
-
## 0.5.0
|
|
510
|
-
|
|
511
|
-
- Fix `bin` file
|
|
512
|
-
|
|
513
|
-
## 0.5.0-next.1
|
|
514
|
-
|
|
515
|
-
- Expose `bin/server.js` as `astro-ls`
|
|
516
|
-
|
|
517
|
-
## 0.5.0-next.0
|
|
518
|
-
|
|
519
|
-
- Moved to scoped `@astrojs/language-server` package
|
|
520
|
-
- Removed some `devDependencies` from the bundle and added them to `dependencies`
|
|
521
|
-
|
|
522
|
-
## 0.4.0
|
|
523
|
-
|
|
524
|
-
### Minor Changes
|
|
525
|
-
|
|
526
|
-
- 06e2597: Adds support for import suggestions
|