Skip to content

Commit

Permalink
Don’t throw when reading CSS file that might not exist (#956)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thecrypticace committed Apr 19, 2024
1 parent 830dc0a commit 273f6c0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/tailwindcss-language-server/src/tw.ts
Expand Up @@ -72,6 +72,7 @@ const TRIGGER_CHARACTERS = [

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

0 comments on commit 273f6c0

Please sign in to comment.