@astrojs/language-server 0.19.1 → 0.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @astrojs/language-server
|
|
2
2
|
|
|
3
|
+
## 0.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7de4967: Add better error messages for Vue and Svelte components with syntax errors
|
|
8
|
+
- Updated dependencies [7de4967]
|
|
9
|
+
- @astrojs/svelte-language-integration@0.1.6
|
|
10
|
+
- @astrojs/vue-language-integration@0.1.1
|
|
11
|
+
|
|
3
12
|
## 0.19.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -12,7 +12,8 @@ export declare enum DiagnosticCodes {
|
|
|
12
12
|
ISOLATED_MODULE_COMPILE_ERR = 1208,
|
|
13
13
|
TYPE_NOT_ASSIGNABLE = 2322,
|
|
14
14
|
JSX_NO_CLOSING_TAG = 17008,
|
|
15
|
-
NO_DECL_IMPLICIT_ANY_TYPE = 7016
|
|
15
|
+
NO_DECL_IMPLICIT_ANY_TYPE = 7016,
|
|
16
|
+
JSX_ELEMENT_NO_CALL = 2604
|
|
16
17
|
}
|
|
17
18
|
export declare class DiagnosticsProviderImpl implements DiagnosticsProvider {
|
|
18
19
|
private readonly languageServiceManager;
|
|
@@ -21,6 +21,7 @@ var DiagnosticCodes;
|
|
|
21
21
|
DiagnosticCodes[DiagnosticCodes["TYPE_NOT_ASSIGNABLE"] = 2322] = "TYPE_NOT_ASSIGNABLE";
|
|
22
22
|
DiagnosticCodes[DiagnosticCodes["JSX_NO_CLOSING_TAG"] = 17008] = "JSX_NO_CLOSING_TAG";
|
|
23
23
|
DiagnosticCodes[DiagnosticCodes["NO_DECL_IMPLICIT_ANY_TYPE"] = 7016] = "NO_DECL_IMPLICIT_ANY_TYPE";
|
|
24
|
+
DiagnosticCodes[DiagnosticCodes["JSX_ELEMENT_NO_CALL"] = 2604] = "JSX_ELEMENT_NO_CALL";
|
|
24
25
|
})(DiagnosticCodes = exports.DiagnosticCodes || (exports.DiagnosticCodes = {}));
|
|
25
26
|
class DiagnosticsProviderImpl {
|
|
26
27
|
constructor(languageServiceManager) {
|
|
@@ -218,6 +219,15 @@ function enhanceIfNecessary(diagnostic) {
|
|
|
218
219
|
message: diagnostic.message.replace('JSX', 'HTML'),
|
|
219
220
|
};
|
|
220
221
|
}
|
|
222
|
+
// JSX Element can't be constructed or called. This happens on syntax errors / invalid components
|
|
223
|
+
if (diagnostic.code === DiagnosticCodes.JSX_ELEMENT_NO_CALL) {
|
|
224
|
+
return {
|
|
225
|
+
...diagnostic,
|
|
226
|
+
message: diagnostic.message
|
|
227
|
+
.replace('JSX element type', 'Component')
|
|
228
|
+
.replace('does not have any construct or call signatures.', 'is not a valid component.\n\nIf this is a Svelte or Vue component, it might have a syntax error that makes it impossible to parse.'),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
221
231
|
// For the rare case where an user might try to put a client directive on something that is not a component
|
|
222
232
|
if (diagnostic.code === DiagnosticCodes.TYPE_NOT_ASSIGNABLE) {
|
|
223
233
|
if (diagnostic.message.includes("Property 'client:") && diagnostic.message.includes("to type 'HTMLProps")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"author": "withastro",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test": "cross-env TS_NODE_TRANSPILE_ONLY=true mocha --timeout 20000 --require ts-node/register \"test/**/*.ts\" --exclude \"test/**/*.d.ts\""
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@astrojs/vue-language-integration": "^0.1.
|
|
23
|
-
"@astrojs/svelte-language-integration": "^0.1.
|
|
22
|
+
"@astrojs/vue-language-integration": "^0.1.1",
|
|
23
|
+
"@astrojs/svelte-language-integration": "^0.1.6",
|
|
24
24
|
"@vscode/emmet-helper": "^2.8.4",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"source-map": "^0.7.3",
|