@astrojs/language-server 2.12.0 → 2.12.7
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/astro2tsx.js
CHANGED
|
@@ -8,7 +8,11 @@ const vscode_html_languageservice_1 = require("vscode-html-languageservice");
|
|
|
8
8
|
const utils_js_1 = require("./utils.js");
|
|
9
9
|
function safeConvertToTSX(content, options) {
|
|
10
10
|
try {
|
|
11
|
-
const tsx = (0, sync_1.convertToTSX)(content, {
|
|
11
|
+
const tsx = (0, sync_1.convertToTSX)(content, {
|
|
12
|
+
filename: options.filename,
|
|
13
|
+
includeScripts: false,
|
|
14
|
+
includeStyles: false,
|
|
15
|
+
});
|
|
12
16
|
return tsx;
|
|
13
17
|
}
|
|
14
18
|
catch (e) {
|
package/dist/core/parseCSS.js
CHANGED
|
@@ -9,15 +9,16 @@ function extractStylesheets(styles) {
|
|
|
9
9
|
exports.extractStylesheets = extractStylesheets;
|
|
10
10
|
function mergeCSSContexts(inlineStyles) {
|
|
11
11
|
const codes = [];
|
|
12
|
-
for (const
|
|
13
|
-
|
|
12
|
+
for (const cssContext of inlineStyles) {
|
|
13
|
+
const isStyleAttribute = cssContext.type === 'style-attribute';
|
|
14
|
+
if (isStyleAttribute)
|
|
14
15
|
codes.push('__ { ');
|
|
15
16
|
codes.push([
|
|
16
|
-
|
|
17
|
+
cssContext.content,
|
|
17
18
|
undefined,
|
|
18
|
-
|
|
19
|
+
cssContext.position.start,
|
|
19
20
|
{
|
|
20
|
-
verification:
|
|
21
|
+
verification: false,
|
|
21
22
|
completion: true,
|
|
22
23
|
semantic: true,
|
|
23
24
|
navigation: true,
|
|
@@ -25,7 +26,7 @@ function mergeCSSContexts(inlineStyles) {
|
|
|
25
26
|
format: false,
|
|
26
27
|
},
|
|
27
28
|
]);
|
|
28
|
-
if (
|
|
29
|
+
if (isStyleAttribute)
|
|
29
30
|
codes.push(' }\n');
|
|
30
31
|
}
|
|
31
32
|
const mappings = (0, buildMappings_js_1.buildMappings)(codes);
|
|
@@ -44,7 +44,11 @@ function getLanguageServicePlugins(connection, ts) {
|
|
|
44
44
|
return [
|
|
45
45
|
(0, html_js_1.create)(),
|
|
46
46
|
(0, volar_service_css_1.create)(),
|
|
47
|
-
(0, volar_service_emmet_1.create)(
|
|
47
|
+
(0, volar_service_emmet_1.create)({
|
|
48
|
+
mappedLanguages: {
|
|
49
|
+
html: 'jsx',
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
48
52
|
...(0, index_js_2.create)(ts),
|
|
49
53
|
(0, volar_service_typescript_twoslash_queries_1.create)(ts),
|
|
50
54
|
(0, index_js_1.create)(),
|
|
@@ -46,7 +46,7 @@ const create = (ts) => {
|
|
|
46
46
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
47
47
|
const root = sourceScript?.generated?.root;
|
|
48
48
|
let tsxLineCount = undefined;
|
|
49
|
-
if (root instanceof index_js_1.AstroVirtualCode) {
|
|
49
|
+
if (root instanceof index_js_1.AstroVirtualCode && decoded?.[1] === 'tsx') {
|
|
50
50
|
// If we have compiler errors, our TSX isn't valid so don't bother showing TS errors
|
|
51
51
|
if (root.hasCompilationErrors)
|
|
52
52
|
return null;
|