@@ -84,7 +84,9 @@ export class TSService {
84
84
tsconfigPath : string ,
85
85
extraFileExtensions : string [ ]
86
86
) : ts . WatchOfConfigFile < ts . BuilderProgram > {
87
- const normalizedTsconfigPath = normalizeFileName ( tsconfigPath ) ;
87
+ const normalizedTsconfigPaths = new Set ( [
88
+ normalizeFileName ( toAbsolutePath ( tsconfigPath ) ) ,
89
+ ] ) ;
88
90
const watchCompilerHost = ts . createWatchCompilerHost (
89
91
tsconfigPath ,
90
92
{
@@ -149,18 +151,28 @@ export class TSService {
149
151
if ( ! code ) {
150
152
return code ;
151
153
}
152
- if ( normalizedTsconfigPath === normalized ) {
154
+ if ( normalizedTsconfigPaths . has ( normalized ) ) {
153
155
const configJson = ts . parseConfigFileTextToJson ( realFileName , code ) ;
154
156
if ( ! configJson . config ) {
155
157
return code ;
156
158
}
157
- let include = undefined ;
159
+ if ( configJson . config . extends ) {
160
+ for ( const extendConfigPath of [ configJson . config . extends ] . flat ( ) ) {
161
+ normalizedTsconfigPaths . add (
162
+ normalizeFileName (
163
+ toAbsolutePath ( extendConfigPath , path . dirname ( normalized ) )
164
+ )
165
+ ) ;
166
+ }
167
+ }
158
168
159
- if ( configJson . config . include ) {
160
- include = [ configJson . config . include ]
161
- . flat ( )
162
- . map ( ( s ) => toVirtualTSXlFileName ( s , extraFileExtensions ) ) ;
169
+ if ( ! configJson . config . include ) {
170
+ return code ;
163
171
}
172
+ const include = [ configJson . config . include ]
173
+ . flat ( )
174
+ . map ( ( s ) => toVirtualTSXlFileName ( s , extraFileExtensions ) ) ;
175
+
164
176
return JSON . stringify ( {
165
177
...configJson . config ,
166
178
include,
@@ -274,8 +286,8 @@ function normalizeFileName(fileName: string) {
274
286
return normalized . toLowerCase ( ) ;
275
287
}
276
288
277
- function toAbsolutePath ( filePath : string ) {
289
+ function toAbsolutePath ( filePath : string , baseDir ?: string ) {
278
290
return path . isAbsolute ( filePath )
279
291
? filePath
280
- : path . join ( process . cwd ( ) , filePath ) ;
292
+ : path . join ( baseDir || process . cwd ( ) , filePath ) ;
281
293
}
0 commit comments