Skip to content

Commit 273f6c0

Browse files
Don’t throw when reading CSS file that might not exist (#956)
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.
1 parent 830dc0a commit 273f6c0

File tree

1 file changed

+1
-0
lines changed
  • packages/tailwindcss-language-server/src

1 file changed

+1
-0
lines changed

packages/tailwindcss-language-server/src/tw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const TRIGGER_CHARACTERS = [
7272

7373
async function getConfigFileFromCssFile(cssFile: string): Promise<string | null> {
7474
let css = await readCssFile(cssFile)
75+
if (!css) return null
7576
let match = css.match(/@config\s*(?<config>'[^']+'|"[^"]+")/)
7677
if (!match) {
7778
return null

0 commit comments

Comments
 (0)