@@ -69,10 +69,10 @@ type Project struct {
6969 // The ID of the snapshot that created the program stored in this project.
7070 ProgramLastUpdate uint64
7171
72+ programFilesWatch * WatchedFiles [patternsAndIgnored ]
7273 failedLookupsWatch * WatchedFiles [map [tspath.Path ]string ]
7374 affectingLocationsWatch * WatchedFiles [map [tspath.Path ]string ]
74- typingsFilesWatch * WatchedFiles [map [tspath.Path ]string ]
75- typingsDirectoryWatch * WatchedFiles [map [tspath.Path ]string ]
75+ typingsWatch * WatchedFiles [patternsAndIgnored ]
7676
7777 checkerPool * checkerPool
7878
@@ -146,26 +146,26 @@ func NewProject(
146146
147147 project .configFilePath = tspath .ToPath (configFileName , currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ())
148148 if builder .sessionOptions .WatchEnabled {
149+ project .programFilesWatch = NewWatchedFiles (
150+ "non-root program files for " + configFileName ,
151+ lsproto .WatchKindCreate | lsproto .WatchKindChange | lsproto .WatchKindDelete ,
152+ core .Identity ,
153+ )
149154 project .failedLookupsWatch = NewWatchedFiles (
150155 "failed lookups for " + configFileName ,
151156 lsproto .WatchKindCreate ,
152- createResolutionLookupGlobMapper (project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
157+ createResolutionLookupGlobMapper (builder . sessionOptions . CurrentDirectory , builder . sessionOptions . DefaultLibraryPath , project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
153158 )
154159 project .affectingLocationsWatch = NewWatchedFiles (
155160 "affecting locations for " + configFileName ,
156161 lsproto .WatchKindCreate | lsproto .WatchKindChange | lsproto .WatchKindDelete ,
157- createResolutionLookupGlobMapper (project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
162+ createResolutionLookupGlobMapper (builder . sessionOptions . CurrentDirectory , builder . sessionOptions . DefaultLibraryPath , project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
158163 )
159164 if builder .sessionOptions .TypingsLocation != "" {
160- project .typingsFilesWatch = NewWatchedFiles (
165+ project .typingsWatch = NewWatchedFiles (
161166 "typings installer files" ,
162167 lsproto .WatchKindCreate | lsproto .WatchKindChange | lsproto .WatchKindDelete ,
163- globMapperForTypingsInstaller ,
164- )
165- project .typingsDirectoryWatch = NewWatchedFiles (
166- "typings installer directories" ,
167- lsproto .WatchKindCreate | lsproto .WatchKindDelete ,
168- globMapperForTypingsInstaller ,
168+ core .Identity ,
169169 )
170170 }
171171 }
@@ -221,10 +221,10 @@ func (p *Project) Clone() *Project {
221221 ProgramUpdateKind : ProgramUpdateKindNone ,
222222 ProgramLastUpdate : p .ProgramLastUpdate ,
223223
224+ programFilesWatch : p .programFilesWatch ,
224225 failedLookupsWatch : p .failedLookupsWatch ,
225226 affectingLocationsWatch : p .affectingLocationsWatch ,
226- typingsFilesWatch : p .typingsFilesWatch ,
227- typingsDirectoryWatch : p .typingsDirectoryWatch ,
227+ typingsWatch : p .typingsWatch ,
228228
229229 checkerPool : p .checkerPool ,
230230
@@ -327,14 +327,19 @@ func (p *Project) CreateProgram() CreateProgramResult {
327327 }
328328}
329329
330- func (p * Project ) CloneWatchers () (failedLookupsWatch * WatchedFiles [map [tspath.Path ]string ], affectingLocationsWatch * WatchedFiles [map [tspath.Path ]string ]) {
330+ func (p * Project ) CloneWatchers (workspaceDir string , libDir string ) (programFilesWatch * WatchedFiles [ patternsAndIgnored ], failedLookupsWatch * WatchedFiles [map [tspath.Path ]string ], affectingLocationsWatch * WatchedFiles [map [tspath.Path ]string ]) {
331331 failedLookups := make (map [tspath.Path ]string )
332332 affectingLocations := make (map [tspath.Path ]string )
333+ programFiles := getNonRootFileGlobs (workspaceDir , libDir , p .Program .GetSourceFiles (), p .CommandLine .FileNamesByPath (), tspath.ComparePathsOptions {
334+ UseCaseSensitiveFileNames : p .host .FS ().UseCaseSensitiveFileNames (),
335+ CurrentDirectory : p .currentDirectory ,
336+ })
333337 extractLookups (p .toPath , failedLookups , affectingLocations , p .Program .GetResolvedModules ())
334338 extractLookups (p .toPath , failedLookups , affectingLocations , p .Program .GetResolvedTypeReferenceDirectives ())
339+ programFilesWatch = p .programFilesWatch .Clone (programFiles )
335340 failedLookupsWatch = p .failedLookupsWatch .Clone (failedLookups )
336341 affectingLocationsWatch = p .affectingLocationsWatch .Clone (affectingLocations )
337- return failedLookupsWatch , affectingLocationsWatch
342+ return programFilesWatch , failedLookupsWatch , affectingLocationsWatch
338343}
339344
340345func (p * Project ) log (msg string ) {
0 commit comments