@@ -39,7 +39,7 @@ import picomatch from 'picomatch'
39
39
import { resolveFrom } from './util/resolveFrom'
40
40
import * as parcel from './watcher/index.js'
41
41
import { equal } from '@tailwindcss/language-service/src/util/array'
42
- import { CONFIG_GLOB , CSS_GLOB , PACKAGE_LOCK_GLOB } from './lib/constants'
42
+ import { CONFIG_GLOB , CSS_GLOB , PACKAGE_LOCK_GLOB , TSCONFIG_GLOB } from './lib/constants'
43
43
import { clearRequireCache , isObject , changeAffectsFile , normalizeDriveLetter } from './utils'
44
44
import { DocumentService } from './documents'
45
45
import { createProjectService , type ProjectService } from './projects'
@@ -48,6 +48,7 @@ import { readCssFile } from './util/css'
48
48
import { ProjectLocator , type ProjectConfig } from './project-locator'
49
49
import type { TailwindCssSettings } from '@tailwindcss/language-service/src/util/state'
50
50
import { createResolver , Resolver } from './resolver'
51
+ import { retry } from './util/retry'
51
52
52
53
const TRIGGER_CHARACTERS = [
53
54
// class attributes
@@ -296,6 +297,7 @@ export class TW {
296
297
let isPackageMatcher = picomatch ( `**/${ PACKAGE_LOCK_GLOB } ` , { dot : true } )
297
298
let isCssMatcher = picomatch ( `**/${ CSS_GLOB } ` , { dot : true } )
298
299
let isConfigMatcher = picomatch ( `**/${ CONFIG_GLOB } ` , { dot : true } )
300
+ let isTSConfigMatcher = picomatch ( `**/${ TSCONFIG_GLOB } ` , { dot : true } )
299
301
300
302
changeLoop: for ( let change of changes ) {
301
303
let normalizedFilename = normalizePath ( change . file )
@@ -335,6 +337,25 @@ export class TW {
335
337
}
336
338
}
337
339
340
+ let isTsconfig = isTSConfigMatcher ( normalizedFilename )
341
+ if ( isTsconfig ) {
342
+ // TODO: Use a refresh() instead of a full server restart
343
+ // let refreshPromise = retry({
344
+ // tries: 4,
345
+ // delay: 250,
346
+ // callback: () => resolver.refresh(),
347
+ // })
348
+
349
+ // try {
350
+ // await refreshPromise
351
+ // } catch (err) {
352
+ // console.error('Unable to reload resolver', err)
353
+ // }
354
+
355
+ needsRestart = true
356
+ break changeLoop
357
+ }
358
+
338
359
for ( let [ , project ] of this . projects ) {
339
360
if ( ! project . state . v4 ) continue
340
361
@@ -424,6 +445,7 @@ export class TW {
424
445
{ globPattern : `**/${ CONFIG_GLOB } ` } ,
425
446
{ globPattern : `**/${ PACKAGE_LOCK_GLOB } ` } ,
426
447
{ globPattern : `**/${ CSS_GLOB } ` } ,
448
+ { globPattern : `**/${ TSCONFIG_GLOB } ` } ,
427
449
] ,
428
450
} ,
429
451
)
@@ -472,7 +494,7 @@ export class TW {
472
494
} else {
473
495
let watch : typeof chokidar . watch = require ( 'chokidar' ) . watch
474
496
let chokidarWatcher = watch (
475
- [ `**/${ CONFIG_GLOB } ` , `**/${ PACKAGE_LOCK_GLOB } ` , `**/${ CSS_GLOB } ` ] ,
497
+ [ `**/${ CONFIG_GLOB } ` , `**/${ PACKAGE_LOCK_GLOB } ` , `**/${ CSS_GLOB } ` , `**/ ${ TSCONFIG_GLOB } ` ] ,
476
498
{
477
499
cwd : base ,
478
500
ignorePermissionErrors : true ,
0 commit comments