Add default excluded files (for non-vscode clients)

master
Brad Cornes 2022-01-17 15:14:09 +00:00
parent f4c6b71a25
commit 08927cb758
1 changed files with 6 additions and 4 deletions

View File

@ -109,6 +109,7 @@ const TRIGGER_CHARACTERS = [
// JIT opacity modifiers // JIT opacity modifiers
'/', '/',
] as const ] as const
const DEFAULT_FILES_EXCLUDE = ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/node_modules/**']
const colorNames = Object.keys(namedColors) const colorNames = Object.keys(namedColors)
@ -257,7 +258,7 @@ async function createProjectService(
let registrations: Promise<BulkUnregistration> let registrations: Promise<BulkUnregistration>
let chokidarWatcher: chokidar.FSWatcher let chokidarWatcher: chokidar.FSWatcher
let ignore = state.editor.globalSettings.tailwindCSS.files?.exclude ?? [] let ignore = state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
function onFileEvents(changes: Array<{ file: string; type: FileChangeType }>): void { function onFileEvents(changes: Array<{ file: string; type: FileChangeType }>): void {
let needsInit = false let needsInit = false
@ -450,7 +451,7 @@ async function createProjectService(
let [configPath] = ( let [configPath] = (
await glob([`**/${CONFIG_FILE_GLOB}`], { await glob([`**/${CONFIG_FILE_GLOB}`], {
cwd: folder, cwd: folder,
ignore: state.editor.globalSettings.tailwindCSS.files?.exclude ?? [], ignore: state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE,
onlyFiles: true, onlyFiles: true,
absolute: true, absolute: true,
suppressErrors: true, suppressErrors: true,
@ -983,9 +984,10 @@ async function createProjectService(
}, },
onUpdateSettings(settings: any): void { onUpdateSettings(settings: any): void {
documentSettingsCache.clear() documentSettingsCache.clear()
let previousExclude = state.editor.globalSettings.tailwindCSS.files?.exclude ?? [] let previousExclude =
state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
state.editor.globalSettings = settings state.editor.globalSettings = settings
if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? [])) { if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE)) {
tryInit() tryInit()
} else { } else {
if (state.enabled) { if (state.enabled) {