| 354 | } |
| 355 | |
| 356 | func (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 | |
| 386 | func (s *Session) DidChangeCompilerOptionsForInferredProjects(ctx context.Context, options *core.CompilerOptions) { |
| 387 | s.compilerOptionsForInferredProjects = options |