@astrojs/language-server 2.16.0 → 2.16.1-alpha.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.js +1 -1
- package/dist/languageServerPlugin.js +1 -1
- package/dist/plugins/astro.d.ts +1 -1
- package/dist/plugins/astro.js +1 -51
- package/package.json +2 -3
package/dist/check.js
CHANGED
|
@@ -128,7 +128,7 @@ class AstroCheck {
|
|
|
128
128
|
(0, svelte_js_1.getSvelteLanguagePlugin)(),
|
|
129
129
|
(0, vue_js_1.getVueLanguagePlugin)(),
|
|
130
130
|
];
|
|
131
|
-
const services = [...(0, index_js_2.create)(this.ts), (0, astro_js_1.create)(
|
|
131
|
+
const services = [...(0, index_js_2.create)(this.ts), (0, astro_js_1.create)()];
|
|
132
132
|
if (tsconfigPath) {
|
|
133
133
|
const includeProjectReference = false; // #920
|
|
134
134
|
this.linter = kit.createTypeScriptChecker(languagePlugins, services, tsconfigPath, includeProjectReference, ({ project }) => {
|
|
@@ -38,7 +38,7 @@ function getLanguageServicePlugins(connection, ts, collectionConfig, initializeP
|
|
|
38
38
|
}),
|
|
39
39
|
(0, volar_service_typescript_twoslash_queries_1.create)(ts),
|
|
40
40
|
(0, index_js_2.create)(),
|
|
41
|
-
(0, astro_js_1.create)(
|
|
41
|
+
(0, astro_js_1.create)(),
|
|
42
42
|
getPrettierService(),
|
|
43
43
|
(0, yaml_js_1.create)(collectionConfig),
|
|
44
44
|
];
|
package/dist/plugins/astro.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { LanguageServicePlugin } from '@volar/language-server';
|
|
2
|
-
export declare const create: (
|
|
2
|
+
export declare const create: () => LanguageServicePlugin;
|
package/dist/plugins/astro.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.create = void 0;
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
4
|
const language_server_1 = require("@volar/language-server");
|
|
9
|
-
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
5
|
const vscode_uri_1 = require("vscode-uri");
|
|
11
6
|
const index_js_1 = require("../core/index.js");
|
|
12
|
-
const
|
|
13
|
-
const create = (ts) => {
|
|
7
|
+
const create = () => {
|
|
14
8
|
return {
|
|
15
9
|
capabilities: {
|
|
16
10
|
completionProvider: {
|
|
@@ -20,7 +14,6 @@ const create = (ts) => {
|
|
|
20
14
|
interFileDependencies: false,
|
|
21
15
|
workspaceDiagnostics: false,
|
|
22
16
|
},
|
|
23
|
-
codeLensProvider: {},
|
|
24
17
|
},
|
|
25
18
|
create(context) {
|
|
26
19
|
return {
|
|
@@ -64,54 +57,11 @@ const create = (ts) => {
|
|
|
64
57
|
};
|
|
65
58
|
}
|
|
66
59
|
},
|
|
67
|
-
provideCodeLenses(document, token) {
|
|
68
|
-
if (token.isCancellationRequested)
|
|
69
|
-
return;
|
|
70
|
-
if (!(0, utils_js_1.isJSDocument)(document.languageId))
|
|
71
|
-
return;
|
|
72
|
-
if (!context.project.typescript)
|
|
73
|
-
return;
|
|
74
|
-
const { uriConverter } = context.project.typescript;
|
|
75
|
-
const languageService = context.inject('typescript/languageService');
|
|
76
|
-
if (!languageService)
|
|
77
|
-
return;
|
|
78
|
-
const tsProgram = languageService.getProgram();
|
|
79
|
-
if (!tsProgram)
|
|
80
|
-
return;
|
|
81
|
-
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(document.uri));
|
|
82
|
-
if (!decoded)
|
|
83
|
-
return;
|
|
84
|
-
const globcodeLens = [];
|
|
85
|
-
const sourceFile = tsProgram.getSourceFile(decoded[0].fsPath);
|
|
86
|
-
function walk() {
|
|
87
|
-
return ts.forEachChild(sourceFile, function cb(node) {
|
|
88
|
-
if (ts.isCallExpression(node) && node.expression.getText() === 'Astro.glob') {
|
|
89
|
-
const globArgument = node.arguments.at(0);
|
|
90
|
-
if (globArgument && decoded) {
|
|
91
|
-
globcodeLens.push(getGlobResultAsCodeLens(globArgument.getText().slice(1, -1), (0, node_path_1.dirname)(uriConverter.asFileName(decoded[0])), document.positionAt(node.arguments.pos)));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return ts.forEachChild(node, cb);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
walk();
|
|
98
|
-
return globcodeLens;
|
|
99
|
-
},
|
|
100
60
|
};
|
|
101
61
|
},
|
|
102
62
|
};
|
|
103
63
|
};
|
|
104
64
|
exports.create = create;
|
|
105
|
-
function getGlobResultAsCodeLens(globText, dir, position) {
|
|
106
|
-
const globResult = fast_glob_1.default.sync(globText, {
|
|
107
|
-
cwd: dir,
|
|
108
|
-
onlyFiles: true,
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
range: language_server_1.Range.create(position, position),
|
|
112
|
-
command: { title: `Matches ${globResult.length} files`, command: '' },
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
65
|
function getFrontmatterCompletion(file, document, position) {
|
|
116
66
|
const base = {
|
|
117
67
|
kind: language_server_1.CompletionItemKind.Snippet,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "2.16.0",
|
|
3
|
+
"version": "2.16.1-alpha.0",
|
|
4
4
|
"author": "withastro",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -64,8 +64,7 @@
|
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsc",
|
|
66
66
|
"dev": "tsc --watch",
|
|
67
|
-
"
|
|
68
|
-
"test": "pnpm sync-fixture && astro-scripts test \"**/*.test.ts\" --teardown-test ./test/misc/teardown.ts --tsx true",
|
|
67
|
+
"test": "astro-scripts test \"**/*.test.ts\" --teardown-test ./test/misc/teardown.ts --tsx true --setup ./test/setup.js",
|
|
69
68
|
"test:match": "pnpm run test --match"
|
|
70
69
|
}
|
|
71
70
|
}
|