WithSnapshotLoadingProjectTree acquires a ref'd snapshot with the requested project trees loaded, then calls fn. The snapshot stays alive for the duration of fn.
( ctx context.Context, requestedProjectTrees *collections.Set[tspath.Path], fn func(*Snapshot), )
| 1062 | // requested project trees loaded, then calls fn. The snapshot stays alive |
| 1063 | // for the duration of fn. |
| 1064 | func (s *Session) WithSnapshotLoadingProjectTree( |
| 1065 | ctx context.Context, |
| 1066 | requestedProjectTrees *collections.Set[tspath.Path], |
| 1067 | fn func(*Snapshot), |
| 1068 | ) { |
| 1069 | snapshot := s.getSnapshot( |
| 1070 | ctx, |
| 1071 | ResourceRequest{ProjectTree: &ProjectTreeRequest{requestedProjectTrees}}, |
| 1072 | true, /*callerRef*/ |
| 1073 | ) |
| 1074 | defer snapshot.Deref(s) |
| 1075 | fn(snapshot) |
| 1076 | } |
| 1077 | |
| 1078 | // GetCurrentLanguageServiceWithAutoImports flushes pending file changes, clones the |
| 1079 | // current snapshot with auto-import preparation for the given URI, then returns a |
no test coverage detected