@astrojs/language-server 0.29.4 → 0.29.6
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/core/worker/TSXService.d.ts +1 -1
- package/dist/plugins/typescript/astro2tsx.d.ts +1 -1
- package/dist/plugins/typescript/astro2tsx.js +1 -1
- package/dist/plugins/typescript/features/DiagnosticsProvider.d.ts +1 -0
- package/dist/plugins/typescript/features/DiagnosticsProvider.js +6 -0
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TSXResult } from '@astrojs/compiler/types';
|
|
1
|
+
import type { TSXResult } from '@astrojs/compiler/types';
|
|
2
2
|
export default function (content: string, fileName: string): TSXResult;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const TSXService_1 = require("../../core/worker/TSXService");
|
|
4
4
|
function default_1(content, fileName) {
|
|
5
|
-
const tsx = (0, TSXService_1.convertToTSX)(content, {
|
|
5
|
+
const tsx = (0, TSXService_1.convertToTSX)(content, { filename: fileName });
|
|
6
6
|
return tsx;
|
|
7
7
|
}
|
|
8
8
|
exports.default = default_1;
|
|
@@ -6,6 +6,7 @@ import type { LanguageServiceManager } from '../LanguageServiceManager';
|
|
|
6
6
|
export declare enum DiagnosticCodes {
|
|
7
7
|
SPREAD_EXPECTED = 1005,
|
|
8
8
|
IS_NOT_A_MODULE = 2306,
|
|
9
|
+
CANNOT_FIND_MODULE = 2307,
|
|
9
10
|
DUPLICATED_JSX_ATTRIBUTES = 17001,
|
|
10
11
|
CANT_RETURN_OUTSIDE_FUNC = 1108,
|
|
11
12
|
ISOLATED_MODULE_COMPILE_ERR = 1208,
|
|
@@ -11,6 +11,7 @@ var DiagnosticCodes;
|
|
|
11
11
|
(function (DiagnosticCodes) {
|
|
12
12
|
DiagnosticCodes[DiagnosticCodes["SPREAD_EXPECTED"] = 1005] = "SPREAD_EXPECTED";
|
|
13
13
|
DiagnosticCodes[DiagnosticCodes["IS_NOT_A_MODULE"] = 2306] = "IS_NOT_A_MODULE";
|
|
14
|
+
DiagnosticCodes[DiagnosticCodes["CANNOT_FIND_MODULE"] = 2307] = "CANNOT_FIND_MODULE";
|
|
14
15
|
DiagnosticCodes[DiagnosticCodes["DUPLICATED_JSX_ATTRIBUTES"] = 17001] = "DUPLICATED_JSX_ATTRIBUTES";
|
|
15
16
|
DiagnosticCodes[DiagnosticCodes["CANT_RETURN_OUTSIDE_FUNC"] = 1108] = "CANT_RETURN_OUTSIDE_FUNC";
|
|
16
17
|
DiagnosticCodes[DiagnosticCodes["ISOLATED_MODULE_COMPILE_ERR"] = 1208] = "ISOLATED_MODULE_COMPILE_ERR";
|
|
@@ -202,6 +203,11 @@ function enhanceIfNecessary(diagnostic) {
|
|
|
202
203
|
}
|
|
203
204
|
return diagnostic;
|
|
204
205
|
}
|
|
206
|
+
if (diagnostic.code === DiagnosticCodes.CANNOT_FIND_MODULE && diagnostic.message.includes('astro:content')) {
|
|
207
|
+
diagnostic.message +=
|
|
208
|
+
"\n\nIf you're using content collections, make sure to run `astro dev`, `astro build` or `astro sync` to first generate the types so you can import from them. If you already ran one of those commands, restarting the language server might be necessary in order for the change to take effect";
|
|
209
|
+
return diagnostic;
|
|
210
|
+
}
|
|
205
211
|
// JSX element has no closing tag. JSX -> HTML
|
|
206
212
|
if (diagnostic.code === DiagnosticCodes.JSX_NO_CLOSING_TAG) {
|
|
207
213
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"author": "withastro",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@astrojs/compiler": "^
|
|
17
|
+
"@astrojs/compiler": "^1.1.1",
|
|
18
18
|
"@jridgewell/trace-mapping": "^0.3.14",
|
|
19
19
|
"@vscode/emmet-helper": "^2.8.4",
|
|
20
20
|
"events": "^3.3.0",
|