setupLanguageService creates a LanguageService for the given snapshot/project. Unlike setupChecker, this does NOT acquire a checker from the pool, so callers that only need an LS (and not a Checker) can avoid blocking on / holding a pooled checker. The LS acquires its own checker internally (keyed
(sd *snapshotData, program *compiler.Program, projectHandle ProjectID, activeFile string)
| 520 | // LS operation acquires a checker exactly once; nested acquisitions (e.g. find-all- |
| 521 | // references) would deadlock on the single-slot persistent checker. |
| 522 | func (s *Session) setupLanguageService(sd *snapshotData, program *compiler.Program, projectHandle ProjectID, activeFile string) (*ls.LanguageService, error) { |
| 523 | projectName := parseProjectHandle(projectHandle) |
| 524 | proj := sd.snapshot.ProjectCollection.GetProjectByPath(projectName) |
| 525 | if proj == nil { |
| 526 | return nil, fmt.Errorf("%w: project %s not found", ErrClientError, projectName) |
| 527 | } |
| 528 | return ls.NewLanguageService(proj.ConfigFilePath(), program, sd.snapshot, activeFile), nil |
| 529 | } |
| 530 | |
| 531 | // HandleRequest implements Handler. |
| 532 | func (s *Session) HandleRequest(ctx context.Context, method string, params json.Value) (any, error) { |
no test coverage detected