@@ -69,10 +69,10 @@ type Project struct {
69
69
// The ID of the snapshot that created the program stored in this project.
70
70
ProgramLastUpdate uint64
71
71
72
+ programFilesWatch * WatchedFiles [patternsAndIgnored ]
72
73
failedLookupsWatch * WatchedFiles [map [tspath.Path ]string ]
73
74
affectingLocationsWatch * WatchedFiles [map [tspath.Path ]string ]
74
- typingsFilesWatch * WatchedFiles [map [tspath.Path ]string ]
75
- typingsDirectoryWatch * WatchedFiles [map [tspath.Path ]string ]
75
+ typingsWatch * WatchedFiles [patternsAndIgnored ]
76
76
77
77
checkerPool * checkerPool
78
78
@@ -146,26 +146,26 @@ func NewProject(
146
146
147
147
project .configFilePath = tspath .ToPath (configFileName , currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ())
148
148
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
+ )
149
154
project .failedLookupsWatch = NewWatchedFiles (
150
155
"failed lookups for " + configFileName ,
151
156
lsproto .WatchKindCreate ,
152
- createResolutionLookupGlobMapper (project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
157
+ createResolutionLookupGlobMapper (builder . sessionOptions . CurrentDirectory , builder . sessionOptions . DefaultLibraryPath , project .currentDirectory , builder .fs .fs .UseCaseSensitiveFileNames ()),
153
158
)
154
159
project .affectingLocationsWatch = NewWatchedFiles (
155
160
"affecting locations for " + configFileName ,
156
161
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 ()),
158
163
)
159
164
if builder .sessionOptions .TypingsLocation != "" {
160
- project .typingsFilesWatch = NewWatchedFiles (
165
+ project .typingsWatch = NewWatchedFiles (
161
166
"typings installer files" ,
162
167
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 ,
169
169
)
170
170
}
171
171
}
@@ -221,10 +221,10 @@ func (p *Project) Clone() *Project {
221
221
ProgramUpdateKind : ProgramUpdateKindNone ,
222
222
ProgramLastUpdate : p .ProgramLastUpdate ,
223
223
224
+ programFilesWatch : p .programFilesWatch ,
224
225
failedLookupsWatch : p .failedLookupsWatch ,
225
226
affectingLocationsWatch : p .affectingLocationsWatch ,
226
- typingsFilesWatch : p .typingsFilesWatch ,
227
- typingsDirectoryWatch : p .typingsDirectoryWatch ,
227
+ typingsWatch : p .typingsWatch ,
228
228
229
229
checkerPool : p .checkerPool ,
230
230
@@ -327,14 +327,19 @@ func (p *Project) CreateProgram() CreateProgramResult {
327
327
}
328
328
}
329
329
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 ]) {
331
331
failedLookups := make (map [tspath.Path ]string )
332
332
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
+ })
333
337
extractLookups (p .toPath , failedLookups , affectingLocations , p .Program .GetResolvedModules ())
334
338
extractLookups (p .toPath , failedLookups , affectingLocations , p .Program .GetResolvedTypeReferenceDirectives ())
339
+ programFilesWatch = p .programFilesWatch .Clone (programFiles )
335
340
failedLookupsWatch = p .failedLookupsWatch .Clone (failedLookups )
336
341
affectingLocationsWatch = p .affectingLocationsWatch .Clone (affectingLocations )
337
- return failedLookupsWatch , affectingLocationsWatch
342
+ return programFilesWatch , failedLookupsWatch , affectingLocationsWatch
338
343
}
339
344
340
345
func (p * Project ) log (msg string ) {
0 commit comments