Skip to content

Commit f40272f

Browse files
committed
Fix files.exclude merging (#464)
1 parent 5b67543 commit f40272f

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

packages/vscode-tailwindcss/src/extension.ts

+10-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
TextEditorDecorationType,
1919
RelativePattern,
2020
ConfigurationScope,
21+
WorkspaceConfiguration,
2122
} from 'vscode'
2223
import {
2324
LanguageClient,
@@ -83,15 +84,16 @@ function getUserLanguages(folder?: WorkspaceFolder): Record<string, string> {
8384
return isObject(langs) ? langs : {}
8485
}
8586

86-
function getExcludePatterns(folder: WorkspaceFolder): string[] {
87-
let globalExclude = Workspace.getConfiguration('files', folder).get('exclude')
88-
let exclude = Object.entries(globalExclude)
89-
.filter(([, value]) => value)
87+
function getGlobalExcludePatterns(scope: ConfigurationScope): string[] {
88+
return Object.entries(Workspace.getConfiguration('files', scope).get('exclude'))
89+
.filter(([, value]) => value === true)
9090
.map(([key]) => key)
91+
}
9192

93+
function getExcludePatterns(scope: ConfigurationScope): string[] {
9294
return [
93-
...exclude,
94-
...(<string[]>Workspace.getConfiguration('tailwindCSS', folder).get('files.exclude')),
95+
...getGlobalExcludePatterns(scope),
96+
...(<string[]>Workspace.getConfiguration('tailwindCSS', scope).get('files.exclude')),
9597
]
9698
}
9799

@@ -107,17 +109,12 @@ function isExcluded(file: string, folder: WorkspaceFolder): boolean {
107109
return false
108110
}
109111

110-
function mergeExcludes(settings, scope) {
111-
// merge `files.exclude` into `tailwindCSS.files.exclude`
112-
let globalExclude = Object.entries(Workspace.getConfiguration('files', scope).get('exclude'))
113-
.filter(([, value]) => value)
114-
.map(([key]) => key)
115-
112+
function mergeExcludes(settings: WorkspaceConfiguration, scope: ConfigurationScope) {
116113
return {
117114
...settings,
118115
files: {
119116
...settings.files,
120-
exclude: [...globalExclude, ...settings.files.exclude],
117+
exclude: [...getGlobalExcludePatterns(scope), ...settings.files.exclude],
121118
},
122119
}
123120
}

0 commit comments

Comments
 (0)