@@ -39,7 +39,7 @@ import picomatch from 'picomatch'
3939import { resolveFrom } from './util/resolveFrom'
4040import * as parcel from './watcher/index.js'
4141import { 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'
4343import { clearRequireCache , isObject , changeAffectsFile , normalizeDriveLetter } from './utils'
4444import { DocumentService } from './documents'
4545import { createProjectService , type ProjectService } from './projects'
@@ -48,6 +48,7 @@ import { readCssFile } from './util/css'
4848import { ProjectLocator , type ProjectConfig } from './project-locator'
4949import type { TailwindCssSettings } from '@tailwindcss/language-service/src/util/state'
5050import { createResolver , Resolver } from './resolver'
51+ import { retry } from './util/retry'
5152
5253const TRIGGER_CHARACTERS = [
5354 // class attributes
@@ -296,6 +297,7 @@ export class TW {
296297 let isPackageMatcher = picomatch ( `**/${ PACKAGE_LOCK_GLOB } ` , { dot : true } )
297298 let isCssMatcher = picomatch ( `**/${ CSS_GLOB } ` , { dot : true } )
298299 let isConfigMatcher = picomatch ( `**/${ CONFIG_GLOB } ` , { dot : true } )
300+ let isTSConfigMatcher = picomatch ( `**/${ TSCONFIG_GLOB } ` , { dot : true } )
299301
300302 changeLoop: for ( let change of changes ) {
301303 let normalizedFilename = normalizePath ( change . file )
@@ -335,6 +337,25 @@ export class TW {
335337 }
336338 }
337339
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+
338359 for ( let [ , project ] of this . projects ) {
339360 if ( ! project . state . v4 ) continue
340361
@@ -429,6 +450,7 @@ export class TW {
429450 { globPattern : `**/${ CONFIG_GLOB } ` } ,
430451 { globPattern : `**/${ PACKAGE_LOCK_GLOB } ` } ,
431452 { globPattern : `**/${ CSS_GLOB } ` } ,
453+ { globPattern : `**/${ TSCONFIG_GLOB } ` } ,
432454 ] ,
433455 } ,
434456 )
@@ -477,7 +499,7 @@ export class TW {
477499 } else {
478500 let watch : typeof chokidar . watch = require ( 'chokidar' ) . watch
479501 let chokidarWatcher = watch (
480- [ `**/${ CONFIG_GLOB } ` , `**/${ PACKAGE_LOCK_GLOB } ` , `**/${ CSS_GLOB } ` ] ,
502+ [ `**/${ CONFIG_GLOB } ` , `**/${ PACKAGE_LOCK_GLOB } ` , `**/${ CSS_GLOB } ` , `**/ ${ TSCONFIG_GLOB } ` ] ,
481503 {
482504 cwd : base ,
483505 ignorePermissionErrors : true ,
0 commit comments