Skip to content

Commit 08927cb

Browse files
committed
Add default excluded files (for non-vscode clients)
1 parent f4c6b71 commit 08927cb

File tree

1 file changed

+6
-4
lines changed
  • packages/tailwindcss-language-server/src

1 file changed

+6
-4
lines changed

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const TRIGGER_CHARACTERS = [
109109
// JIT opacity modifiers
110110
'/',
111111
] as const
112+
const DEFAULT_FILES_EXCLUDE = ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/node_modules/**']
112113

113114
const colorNames = Object.keys(namedColors)
114115

@@ -257,7 +258,7 @@ async function createProjectService(
257258
let registrations: Promise<BulkUnregistration>
258259

259260
let chokidarWatcher: chokidar.FSWatcher
260-
let ignore = state.editor.globalSettings.tailwindCSS.files?.exclude ?? []
261+
let ignore = state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
261262

262263
function onFileEvents(changes: Array<{ file: string; type: FileChangeType }>): void {
263264
let needsInit = false
@@ -450,7 +451,7 @@ async function createProjectService(
450451
let [configPath] = (
451452
await glob([`**/${CONFIG_FILE_GLOB}`], {
452453
cwd: folder,
453-
ignore: state.editor.globalSettings.tailwindCSS.files?.exclude ?? [],
454+
ignore: state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE,
454455
onlyFiles: true,
455456
absolute: true,
456457
suppressErrors: true,
@@ -983,9 +984,10 @@ async function createProjectService(
983984
},
984985
onUpdateSettings(settings: any): void {
985986
documentSettingsCache.clear()
986-
let previousExclude = state.editor.globalSettings.tailwindCSS.files?.exclude ?? []
987+
let previousExclude =
988+
state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
987989
state.editor.globalSettings = settings
988-
if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? [])) {
990+
if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE)) {
989991
tryInit()
990992
} else {
991993
if (state.enabled) {

0 commit comments

Comments
 (0)