Skip to content

Commit 24cff1a

Browse files
fabon-fPrincesseuh
andauthored
chore: Replace fast-glob with tinyglobby in language server (#15057)
* chore: Replace fast-glob with tinyglobby in language server * Use `expandDirectories` option for compatibility with fast-glob * Update packages/language-tools/language-server/src/check.ts --------- Co-authored-by: Erika <[email protected]>
1 parent fa9c464 commit 24cff1a

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

packages/language-tools/language-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"@volar/language-core": "~2.4.23",
3535
"@volar/language-server": "~2.4.23",
3636
"@volar/language-service": "~2.4.23",
37-
"fast-glob": "^3.2.12",
3837
"muggle-string": "^0.4.1",
38+
"tinyglobby": "^0.2.15",
3939
"volar-service-css": "0.0.67",
4040
"volar-service-emmet": "0.0.67",
4141
"volar-service-html": "0.0.67",

packages/language-tools/language-server/src/check.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { resolve } from 'node:path';
44
import { pathToFileURL } from 'node:url';
55
import * as kit from '@volar/kit';
66
import { Diagnostic, DiagnosticSeverity } from '@volar/language-server';
7-
import fg from 'fast-glob';
7+
import { globSync } from 'tinyglobby';
88
import { URI } from 'vscode-uri';
99
import { addAstroTypes, getAstroLanguagePlugin } from './core/index.js';
1010
import { getSvelteLanguagePlugin } from './core/svelte.js';
@@ -166,10 +166,12 @@ export class AstroCheck {
166166
languagePlugins,
167167
services,
168168
() => {
169-
return fg.sync('**/*.astro', {
169+
return globSync('**/*.astro', {
170170
cwd: this.workspacePath,
171171
ignore: ['node_modules'],
172172
absolute: true,
173+
// Required to avoid tinyglobby running eternally
174+
expandDirectories: false,
173175
});
174176
},
175177
undefined,

packages/language-tools/language-server/src/plugins/astro.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Range,
1515
TextEdit,
1616
} from '@volar/language-server';
17-
import fg from 'fast-glob';
17+
import { globSync } from 'tinyglobby';
1818
import type { Provide } from 'volar-service-typescript';
1919
import type { TextDocument } from 'vscode-html-languageservice';
2020
import { URI } from 'vscode-uri';
@@ -126,9 +126,10 @@ export const create = (ts: typeof import('typescript')): LanguageServicePlugin =
126126
};
127127

128128
function getGlobResultAsCodeLens(globText: string, dir: string, position: Position) {
129-
const globResult = fg.sync(globText, {
129+
const globResult = globSync(globText, {
130130
cwd: dir,
131131
onlyFiles: true,
132+
expandDirectories: false,
132133
});
133134

134135
return {

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)