@@ -78,10 +78,11 @@ import { getColor } from 'tailwindcss-language-service/src/util/color'
78
78
import * as culori from 'culori'
79
79
import namedColors from 'color-name'
80
80
import tailwindPlugins from './lib/plugins'
81
- import isExcluded , { DEFAULT_FILES_EXCLUDE } from './util/isExcluded'
81
+ import isExcluded from './util/isExcluded'
82
82
import { getFileFsPath , normalizeFileNameToFsPath } from './util/uri'
83
83
import { equal } from 'tailwindcss-language-service/src/util/array'
84
84
import preflight from 'tailwindcss/lib/css/preflight.css'
85
+ import merge from 'deepmerge'
85
86
86
87
// @ts -ignore
87
88
global . __preflight = preflight
@@ -238,7 +239,42 @@ async function createProjectService(
238
239
scopeUri : uri ,
239
240
} ) ,
240
241
] )
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
+ )
242
278
documentSettingsCache . set ( uri , config )
243
279
return config
244
280
}
@@ -266,7 +302,7 @@ async function createProjectService(
266
302
}
267
303
268
304
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
270
306
271
307
function onFileEvents ( changes : Array < { file : string ; type : FileChangeType } > ) : void {
272
308
let needsInit = false
@@ -421,7 +457,7 @@ async function createProjectService(
421
457
configPath = (
422
458
await glob ( [ `**/${ CONFIG_FILE_GLOB } ` ] , {
423
459
cwd : folder ,
424
- ignore : state . editor . globalSettings . tailwindCSS . files ? .exclude ?? DEFAULT_FILES_EXCLUDE ,
460
+ ignore : state . editor . globalSettings . tailwindCSS . files . exclude ,
425
461
onlyFiles : true ,
426
462
absolute : true ,
427
463
suppressErrors : true ,
@@ -937,10 +973,9 @@ async function createProjectService(
937
973
} ,
938
974
async onUpdateSettings ( settings : any ) : Promise < void > {
939
975
documentSettingsCache . clear ( )
940
- let previousExclude =
941
- state . editor . globalSettings . tailwindCSS . files ?. exclude ?? DEFAULT_FILES_EXCLUDE
976
+ let previousExclude = state . editor . globalSettings . tailwindCSS . files . exclude
942
977
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 ) ) {
944
979
tryInit ( )
945
980
} else {
946
981
if ( state . enabled ) {
0 commit comments