@@ -78,10 +78,11 @@ import { getColor } from 'tailwindcss-language-service/src/util/color'
7878import * as culori from 'culori'
7979import namedColors from 'color-name'
8080import tailwindPlugins from './lib/plugins'
81- import isExcluded , { DEFAULT_FILES_EXCLUDE } from './util/isExcluded'
81+ import isExcluded from './util/isExcluded'
8282import { getFileFsPath , normalizeFileNameToFsPath } from './util/uri'
8383import { equal } from 'tailwindcss-language-service/src/util/array'
8484import preflight from 'tailwindcss/lib/css/preflight.css'
85+ import merge from 'deepmerge'
8586
8687// @ts -ignore
8788global . __preflight = preflight
@@ -238,7 +239,42 @@ async function createProjectService(
238239 scopeUri : uri ,
239240 } ) ,
240241 ] )
241- let config : Settings = { editor, tailwindCSS }
242+ editor = isObject ( editor ) ? editor : { }
243+ tailwindCSS = isObject ( tailwindCSS ) ? tailwindCSS : { }
244+
245+ let config : Settings = merge < Settings > (
246+ {
247+ editor : { tabSize : 2 } ,
248+ tailwindCSS : {
249+ emmetCompletions : false ,
250+ classAttributes : [ 'class' , 'className' , 'ngClass' ] ,
251+ codeActions : true ,
252+ hovers : true ,
253+ suggestions : true ,
254+ validate : true ,
255+ colorDecorators : true ,
256+ rootFontSize : 16 ,
257+ lint : {
258+ cssConflict : 'warning' ,
259+ invalidApply : 'error' ,
260+ invalidScreen : 'error' ,
261+ invalidVariant : 'error' ,
262+ invalidConfigPath : 'error' ,
263+ invalidTailwindDirective : 'error' ,
264+ recommendedVariantOrder : 'warning' ,
265+ } ,
266+ showPixelEquivalents : true ,
267+ includeLanguages : { } ,
268+ files : { exclude : [ '**/.git/**' , '**/node_modules/**' , '**/.hg/**' , '**/.svn/**' ] } ,
269+ experimental : {
270+ classRegex : [ ] ,
271+ configFile : null ,
272+ } ,
273+ } ,
274+ } ,
275+ { editor, tailwindCSS } ,
276+ { arrayMerge : ( _destinationArray , sourceArray , _options ) => sourceArray }
277+ )
242278 documentSettingsCache . set ( uri , config )
243279 return config
244280 }
@@ -266,7 +302,7 @@ async function createProjectService(
266302 }
267303
268304 let chokidarWatcher : chokidar . FSWatcher
269- let ignore = state . editor . globalSettings . tailwindCSS . files ? .exclude ?? DEFAULT_FILES_EXCLUDE
305+ let ignore = state . editor . globalSettings . tailwindCSS . files . exclude
270306
271307 function onFileEvents ( changes : Array < { file : string ; type : FileChangeType } > ) : void {
272308 let needsInit = false
@@ -421,7 +457,7 @@ async function createProjectService(
421457 configPath = (
422458 await glob ( [ `**/${ CONFIG_FILE_GLOB } ` ] , {
423459 cwd : folder ,
424- ignore : state . editor . globalSettings . tailwindCSS . files ? .exclude ?? DEFAULT_FILES_EXCLUDE ,
460+ ignore : state . editor . globalSettings . tailwindCSS . files . exclude ,
425461 onlyFiles : true ,
426462 absolute : true ,
427463 suppressErrors : true ,
@@ -937,10 +973,9 @@ async function createProjectService(
937973 } ,
938974 async onUpdateSettings ( settings : any ) : Promise < void > {
939975 documentSettingsCache . clear ( )
940- let previousExclude =
941- state . editor . globalSettings . tailwindCSS . files ?. exclude ?? DEFAULT_FILES_EXCLUDE
976+ let previousExclude = state . editor . globalSettings . tailwindCSS . files . exclude
942977 state . editor . globalSettings = await state . editor . getConfiguration ( )
943- if ( ! equal ( previousExclude , settings . tailwindCSS . files ? .exclude ?? DEFAULT_FILES_EXCLUDE ) ) {
978+ if ( ! equal ( previousExclude , settings . tailwindCSS . files . exclude ) ) {
944979 tryInit ( )
945980 } else {
946981 if ( state . enabled ) {
0 commit comments