Filter out empty `files.exclude` items
parent
85cf5edccb
commit
e173a6fa64
|
@ -980,11 +980,11 @@ async function createProjectService(
|
||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdateSettings(settings: any): void {
|
async onUpdateSettings(settings: any): Promise<void> {
|
||||||
documentSettingsCache.clear()
|
documentSettingsCache.clear()
|
||||||
let previousExclude =
|
let previousExclude =
|
||||||
state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
|
state.editor.globalSettings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE
|
||||||
state.editor.globalSettings = settings
|
state.editor.globalSettings = await state.editor.getConfiguration()
|
||||||
if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE)) {
|
if (!equal(previousExclude, settings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE)) {
|
||||||
tryInit()
|
tryInit()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -88,12 +88,15 @@ function getGlobalExcludePatterns(scope: ConfigurationScope): string[] {
|
||||||
return Object.entries(Workspace.getConfiguration('files', scope).get('exclude'))
|
return Object.entries(Workspace.getConfiguration('files', scope).get('exclude'))
|
||||||
.filter(([, value]) => value === true)
|
.filter(([, value]) => value === true)
|
||||||
.map(([key]) => key)
|
.map(([key]) => key)
|
||||||
|
.filter(Boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExcludePatterns(scope: ConfigurationScope): string[] {
|
function getExcludePatterns(scope: ConfigurationScope): string[] {
|
||||||
return [
|
return [
|
||||||
...getGlobalExcludePatterns(scope),
|
...getGlobalExcludePatterns(scope),
|
||||||
...(<string[]>Workspace.getConfiguration('tailwindCSS', scope).get('files.exclude')),
|
...(<string[]>Workspace.getConfiguration('tailwindCSS', scope).get('files.exclude')).filter(
|
||||||
|
Boolean
|
||||||
|
),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,12 +112,12 @@ function isExcluded(file: string, folder: WorkspaceFolder): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeExcludes(settings: WorkspaceConfiguration, scope: ConfigurationScope) {
|
function mergeExcludes(settings: WorkspaceConfiguration, scope: ConfigurationScope): any {
|
||||||
return {
|
return {
|
||||||
...settings,
|
...settings,
|
||||||
files: {
|
files: {
|
||||||
...settings.files,
|
...settings.files,
|
||||||
exclude: [...getGlobalExcludePatterns(scope), ...settings.files.exclude],
|
exclude: getExcludePatterns(scope),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue