@astrojs/language-server 2.16.0 → 2.16.1-beta.1

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 CHANGED
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.AstroCheck = exports.DiagnosticSeverity = exports.Diagnostic = void 0;
40
37
  const node_fs_1 = require("node:fs");
@@ -45,7 +42,7 @@ const kit = __importStar(require("@volar/kit"));
45
42
  const language_server_1 = require("@volar/language-server");
46
43
  Object.defineProperty(exports, "Diagnostic", { enumerable: true, get: function () { return language_server_1.Diagnostic; } });
47
44
  Object.defineProperty(exports, "DiagnosticSeverity", { enumerable: true, get: function () { return language_server_1.DiagnosticSeverity; } });
48
- const fast_glob_1 = __importDefault(require("fast-glob"));
45
+ const tinyglobby_1 = require("tinyglobby");
49
46
  const vscode_uri_1 = require("vscode-uri");
50
47
  const index_js_1 = require("./core/index.js");
51
48
  const svelte_js_1 = require("./core/svelte.js");
@@ -128,7 +125,7 @@ class AstroCheck {
128
125
  (0, svelte_js_1.getSvelteLanguagePlugin)(),
129
126
  (0, vue_js_1.getVueLanguagePlugin)(),
130
127
  ];
131
- const services = [...(0, index_js_2.create)(this.ts), (0, astro_js_1.create)(this.ts)];
128
+ const services = [...(0, index_js_2.create)(this.ts), (0, astro_js_1.create)()];
132
129
  if (tsconfigPath) {
133
130
  const includeProjectReference = false; // #920
134
131
  this.linter = kit.createTypeScriptChecker(languagePlugins, services, tsconfigPath, includeProjectReference, ({ project }) => {
@@ -139,10 +136,12 @@ class AstroCheck {
139
136
  }
140
137
  else {
141
138
  this.linter = kit.createTypeScriptInferredChecker(languagePlugins, services, () => {
142
- return fast_glob_1.default.sync('**/*.astro', {
139
+ return (0, tinyglobby_1.globSync)('**/*.astro', {
143
140
  cwd: this.workspacePath,
144
141
  ignore: ['node_modules'],
145
142
  absolute: true,
143
+ // Required to avoid tinyglobby running eternally
144
+ expandDirectories: false,
146
145
  });
147
146
  }, undefined, ({ project }) => {
148
147
  const { languageServiceHost } = project.typescript;
@@ -18,7 +18,7 @@ function safeConvertToTSX(content, options) {
18
18
  return tsx;
19
19
  }
20
20
  catch (e) {
21
- console.error(`There was an error transforming ${options.filename} to TSX. An empty file will be returned instead. Please create an issue: https://github.com/withastro/language-tools/issues\nError: ${e}.`);
21
+ console.error(`There was an error transforming ${options.filename} to TSX. An empty file will be returned instead. Please create an issue: https://github.com/withastro/astro/issues\nError: ${e}.`);
22
22
  return {
23
23
  code: '',
24
24
  map: {
@@ -34,7 +34,7 @@ function safeConvertToTSX(content, options) {
34
34
  code: 1000,
35
35
  location: { file: options.filename, line: 1, column: 1, length: content.length },
36
36
  severity: 1,
37
- text: `The Astro compiler encountered an unknown error while transform this file to TSX. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/language-tools/issues`,
37
+ text: `The Astro compiler encountered an unknown error while transform this file to TSX. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/astro/issues`,
38
38
  },
39
39
  ],
40
40
  metaRanges: {
@@ -15,7 +15,7 @@ function safeParseAst(fileName, input, parseOptions) {
15
15
  return parseResult;
16
16
  }
17
17
  catch (e) {
18
- console.error(`There was an error parsing ${fileName}'s AST. An empty AST will be returned instead to avoid breaking the server. Please create an issue: https://github.com/withastro/language-tools/issues\nError: ${e}.`);
18
+ console.error(`There was an error parsing ${fileName}'s AST. An empty AST will be returned instead to avoid breaking the server. Please create an issue: https://github.com/withastro/astro/issues\nError: ${e}.`);
19
19
  return {
20
20
  ast: {
21
21
  type: 'root',
@@ -31,7 +31,7 @@ function safeParseAst(fileName, input, parseOptions) {
31
31
  length: input.length,
32
32
  },
33
33
  severity: 1,
34
- text: `The Astro compiler encountered an unknown error while parsing this file's AST. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/language-tools/issues`,
34
+ text: `The Astro compiler encountered an unknown error while parsing this file's AST. Please create an issue with your code and the error shown in the server's logs: https://github.com/withastro/astro/issues`,
35
35
  },
36
36
  ],
37
37
  };
@@ -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)(ts),
41
+ (0, astro_js_1.create)(),
42
42
  getPrettierService(),
43
43
  (0, yaml_js_1.create)(collectionConfig),
44
44
  ];
@@ -1,2 +1,2 @@
1
1
  import type { LanguageServicePlugin } from '@volar/language-server';
2
- export declare const create: (ts: typeof import("typescript")) => LanguageServicePlugin;
2
+ export declare const create: () => LanguageServicePlugin;
@@ -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 utils_js_1 = require("./utils.js");
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-beta.1",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,33 +20,33 @@
20
20
  "astro-ls": "./bin/nodeServer.js"
21
21
  },
22
22
  "dependencies": {
23
- "@astrojs/compiler": "^2.10.3",
23
+ "@astrojs/compiler": "^2.13.0",
24
24
  "@astrojs/yaml2ts": "^0.2.2",
25
- "@jridgewell/sourcemap-codec": "^1.4.15",
26
- "@volar/kit": "~2.4.23",
27
- "@volar/language-core": "~2.4.23",
28
- "@volar/language-server": "~2.4.23",
29
- "@volar/language-service": "~2.4.23",
30
- "fast-glob": "^3.2.12",
25
+ "@jridgewell/sourcemap-codec": "^1.5.5",
26
+ "@volar/kit": "~2.4.27",
27
+ "@volar/language-core": "~2.4.27",
28
+ "@volar/language-server": "~2.4.27",
29
+ "@volar/language-service": "~2.4.27",
31
30
  "muggle-string": "^0.4.1",
32
- "volar-service-css": "0.0.66",
33
- "volar-service-emmet": "0.0.66",
34
- "volar-service-html": "0.0.66",
35
- "volar-service-prettier": "0.0.66",
36
- "volar-service-typescript": "0.0.66",
37
- "volar-service-typescript-twoslash-queries": "0.0.66",
38
- "volar-service-yaml": "0.0.66",
39
- "vscode-html-languageservice": "^5.5.2",
31
+ "tinyglobby": "^0.2.15",
32
+ "volar-service-css": "0.0.68",
33
+ "volar-service-emmet": "0.0.68",
34
+ "volar-service-html": "0.0.68",
35
+ "volar-service-prettier": "0.0.68",
36
+ "volar-service-typescript": "0.0.68",
37
+ "volar-service-typescript-twoslash-queries": "0.0.68",
38
+ "volar-service-yaml": "0.0.68",
39
+ "vscode-html-languageservice": "^5.6.1",
40
40
  "vscode-uri": "^3.1.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^20.9.0",
44
- "@volar/test-utils": "~2.4.23",
45
- "@volar/typescript": "~2.4.23",
46
- "tsx": "^4.20.6",
44
+ "@volar/test-utils": "~2.4.27",
45
+ "@volar/typescript": "~2.4.27",
46
+ "tsx": "^4.21.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vscode-languageserver-protocol": "^3.17.5",
49
- "vscode-languageserver-textdocument": "^1.0.11",
49
+ "vscode-languageserver-textdocument": "^1.0.12",
50
50
  "astro-scripts": "0.0.14"
51
51
  },
52
52
  "peerDependencies": {
@@ -64,8 +64,7 @@
64
64
  "scripts": {
65
65
  "build": "tsc",
66
66
  "dev": "tsc --watch",
67
- "sync-fixture": "pnpm --dir ./test/fixture sync",
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
  }