From d7e8976817022e19473dd65bd0205c0131505693 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Wed, 28 Aug 2024 10:56:21 +0200 Subject: [PATCH 1/2] Handle postcss throwing when parsing more complex files --- .../src/project-locator.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 50c3d426..9e39f67d 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -615,17 +615,21 @@ class FileEntry { } async resolveSourceDirectives() { - if (this.sources.length > 0) { - return - } + try { + if (this.sources.length > 0) { + return + } - // Note: This should eventually use the DesignSystem to extract the same - // sources also discovered by tailwind. Since we don't have everything yet - // to initialize the design system though, we set up a simple postcss at - // rule exporter instead for now. - await postcss([extractSourceDirectives(this.sources)]).process(this.content, { - from: this.realpath, - }) + // Note: This should eventually use the DesignSystem to extract the same + // sources also discovered by tailwind. Since we don't have everything yet + // to initialize the design system though, we set up a simple postcss at + // rule exporter instead for now. + await postcss([extractSourceDirectives(this.sources)]).process(this.content, { + from: this.realpath, + }) + } catch (err) { + // + } } /** From 4d5fb732c14da2d0ad1ee4182eb926f5b5b2d258 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Wed, 28 Aug 2024 11:08:49 +0200 Subject: [PATCH 2/2] Add change log --- packages/vscode-tailwindcss/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-tailwindcss/CHANGELOG.md b/packages/vscode-tailwindcss/CHANGELOG.md index de7ac14e..25b06e9f 100644 --- a/packages/vscode-tailwindcss/CHANGELOG.md +++ b/packages/vscode-tailwindcss/CHANGELOG.md @@ -2,7 +2,7 @@ ## Prerelease -- Nothing yet! +- Fix an issue that caused the language server for any project with a non-standard CSS file to crash ([#1030](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1030)) ## 0.12.7