Fix for missing `files` config

master
Brad Cornes 2022-01-17 15:40:55 +00:00
parent 6eb310dfda
commit 9bc82821c7
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,7 @@ import * as culori from 'culori'
import namedColors from 'color-name'
import preflight from './lib/preflight'
import tailwindPlugins from './lib/plugins'
import isExcluded from './util/isExcluded'
import isExcluded, { DEFAULT_FILES_EXCLUDE } from './util/isExcluded'
import { getFileFsPath, normalizeFileNameToFsPath } from './util/uri'
import { equal } from 'tailwindcss-language-service/src/util/array'
@ -109,7 +109,6 @@ const TRIGGER_CHARACTERS = [
// JIT opacity modifiers
'/',
] as const
const DEFAULT_FILES_EXCLUDE = ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/node_modules/**']
const colorNames = Object.keys(namedColors)

View File

@ -4,11 +4,13 @@ import { State } from 'tailwindcss-language-service/src/util/state'
import { TextDocument } from 'vscode-languageserver-textdocument'
import { getFileFsPath } from './uri'
export const DEFAULT_FILES_EXCLUDE = ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/node_modules/**']
export default async function isExcluded(state: State, document: TextDocument): Promise<boolean> {
let settings = await state.editor.getConfiguration(document.uri)
let file = getFileFsPath(document.uri)
for (let pattern of settings.tailwindCSS.files.exclude) {
for (let pattern of settings.tailwindCSS.files?.exclude ?? DEFAULT_FILES_EXCLUDE) {
if (minimatch(file, path.join(state.editor.folder, pattern))) {
return true
}