Skip to content

Commit ce776b2

Browse files
committed
Make sure file exclusions work correctly on Windows
1 parent 765ebce commit ce776b2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/tailwindcss-language-server/src/util/isExcluded.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from 'node:path'
33
import type { TextDocument } from 'vscode-languageserver-textdocument'
44
import type { State } from '@tailwindcss/language-service/src/util/state'
55
import { getFileFsPath } from './uri'
6+
import { normalizePath, normalizeDriveLetter } from '../utils'
67

78
export default async function isExcluded(
89
state: State,
@@ -11,8 +12,15 @@ export default async function isExcluded(
1112
): Promise<boolean> {
1213
let settings = await state.editor.getConfiguration(document.uri)
1314

15+
file = normalizePath(file)
16+
file = normalizeDriveLetter(file)
17+
1418
for (let pattern of settings.tailwindCSS.files.exclude) {
15-
if (picomatch(path.join(state.editor.folder, pattern))(file)) {
19+
pattern = path.join(state.editor.folder, pattern)
20+
pattern = normalizePath(pattern)
21+
pattern = normalizeDriveLetter(pattern)
22+
23+
if (picomatch(pattern)(file)) {
1624
return true
1725
}
1826
}

0 commit comments

Comments
 (0)