diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index 124b91655a13658f6889a9ea817486ec7823dcc8..a8bcf9c0479c3b5ef54b9f08ad47b41f2597448a 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -19,8 +19,6 @@ TextEditorDecorationType, RelativePattern, ConfigurationScope, * Copyright (c) Microsoft Corporation. All rights reserved. -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved. import { LanguageClient, @@ -86,18 +84,16 @@ const langs = Workspace.getConfiguration('tailwindCSS', folder).includeLanguages return isObject(langs) ? langs : {} } -function getGlobalExcludePatterns(scope: ConfigurationScope): string[] { +function getExcludePatterns(folder: WorkspaceFolder): string[] { - return Object.entries(Workspace.getConfiguration('files', scope).get('exclude')) + let globalExclude = Workspace.getConfiguration('files', folder).get('exclude') - .filter(([, value]) => value === true) + let exclude = Object.entries(globalExclude) + .filter(([, value]) => value) .map(([key]) => key) -} workspace as Workspace, - window as Window, - workspace as Workspace, ExtensionContext, - ...getGlobalExcludePatterns(scope), + ...exclude, - ...(Workspace.getConfiguration('tailwindCSS', scope).get('files.exclude')), + ...(Workspace.getConfiguration('tailwindCSS', folder).get('files.exclude')), ] } @@ -113,12 +109,17 @@ return false } -function mergeExcludes(settings: WorkspaceConfiguration, scope: ConfigurationScope) { +function mergeExcludes(settings, scope) { + // merge `files.exclude` into `tailwindCSS.files.exclude` + let globalExclude = Object.entries(Workspace.getConfiguration('files', scope).get('exclude')) + .filter(([, value]) => value) + .map(([key]) => key) + return { ...settings, files: { ...settings.files, - exclude: [...getGlobalExcludePatterns(scope), ...settings.files.exclude], + exclude: [...globalExclude, ...settings.files.exclude], }, } }