(ctx context.Context, uri lsproto.DocumentUri, callerRef bool)
| 973 | } |
| 974 | |
| 975 | func (s *Session) getSnapshotAndDefaultProject(ctx context.Context, uri lsproto.DocumentUri, callerRef bool) (*Snapshot, *Project, *ls.LanguageService, error) { |
| 976 | snapshot := s.getSnapshot( |
| 977 | ctx, |
| 978 | ResourceRequest{Documents: []lsproto.DocumentUri{uri}}, |
| 979 | callerRef, |
| 980 | ) |
| 981 | project := snapshot.GetDefaultProject(uri) |
| 982 | if project == nil { |
| 983 | return nil, nil, nil, fmt.Errorf("no project found for URI %s", uri) |
| 984 | } |
| 985 | return snapshot, project, ls.NewLanguageService(project.configFilePath, project.GetProgram(), snapshot, uri.FileName()), nil |
| 986 | } |
| 987 | |
| 988 | func (s *Session) GetLanguageService(ctx context.Context, uri lsproto.DocumentUri) (*ls.LanguageService, error) { |
| 989 | _, _, languageService, err := s.getSnapshotAndDefaultProject(ctx, uri, false /*callerRef*/) |
no test coverage detected