MCPcopy Create free account
hub / github.com/microsoft/typescript-go / DidChangeWatchedFiles

Method DidChangeWatchedFiles

internal/project/session.go:356–384  ·  view source on GitHub ↗
(ctx context.Context, changes []*lsproto.FileEvent)

Source from the content-addressed store, hash-verified

354}
355
356func (s *Session) DidChangeWatchedFiles(ctx context.Context, changes []*lsproto.FileEvent) {
357 fileChanges := make([]FileChange, 0, len(changes))
358 for _, change := range changes {
359 var kind FileChangeKind
360 switch change.Type {
361 case lsproto.FileChangeTypeCreated:
362 kind = FileChangeKindWatchCreate
363 case lsproto.FileChangeTypeChanged:
364 kind = FileChangeKindWatchChange
365 case lsproto.FileChangeTypeDeleted:
366 kind = FileChangeKindWatchDelete
367 default:
368 continue // Ignore unknown change types.
369 }
370 fileChanges = append(fileChanges, FileChange{
371 Kind: kind,
372 URI: change.Uri,
373 })
374 }
375
376 s.pendingFileChangesMu.Lock()
377 s.pendingFileChanges = append(s.pendingFileChanges, fileChanges...)
378 s.pendingFileChangesMu.Unlock()
379
380 // Schedule a debounced diagnostics refresh
381 s.ScheduleDiagnosticsRefresh()
382 s.cancelWarmAutoImportCache()
383 s.scheduleIdleCacheClean()
384}
385
386func (s *Session) DidChangeCompilerOptionsForInferredProjects(ctx context.Context, options *core.CompilerOptions) {
387 s.compilerOptionsForInferredProjects = options

Callers 14

handleInitializedMethod · 0.80
TestRegistryLifecycleFunction · 0.80
TestProjectLifetimeFunction · 0.80
TestSessionFunction · 0.80
session_test.goFile · 0.80
TestProjectFunction · 0.80
TestPushDiagnosticsFunction · 0.80

Calls 8

lenFunction · 0.85
makeFunction · 0.50
appendFunction · 0.50
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 11

TestRegistryLifecycleFunction · 0.64
TestProjectLifetimeFunction · 0.64
TestSessionFunction · 0.64
TestProjectFunction · 0.64
TestPushDiagnosticsFunction · 0.64
TestConfigFileChangesFunction · 0.64
TestATAFunction · 0.64