From 273f6c0e138b238f5d4f9ae4e02219e4b741a06e Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 19 Apr 2024 13:08:34 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20throw=20when=20reading=20CSS=20?= =?UTF-8?q?file=20that=20might=20not=20exist=20(#956)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This happens likely because of a race condition when moving CSS files. If the event we get from the watcher isn’t a delete but the file doesn’t exist in that location any more the server will throw an error. --- packages/tailwindcss-language-server/src/tw.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tailwindcss-language-server/src/tw.ts b/packages/tailwindcss-language-server/src/tw.ts index 39a439e8..bd25668a 100644 --- a/packages/tailwindcss-language-server/src/tw.ts +++ b/packages/tailwindcss-language-server/src/tw.ts @@ -72,6 +72,7 @@ const TRIGGER_CHARACTERS = [ async function getConfigFileFromCssFile(cssFile: string): Promise { let css = await readCssFile(cssFile) + if (!css) return null let match = css.match(/@config\s*(?'[^']+'|"[^"]+")/) if (!match) { return null