handleGetDefaultProjectForFile returns the default project for a given file, or nil if no project currently contains the file.
(ctx context.Context, params *GetDefaultProjectForFileParams)
| 995 | // handleGetDefaultProjectForFile returns the default project for a given file, |
| 996 | // or nil if no project currently contains the file. |
| 997 | func (s *Session) handleGetDefaultProjectForFile(ctx context.Context, params *GetDefaultProjectForFileParams) (*ProjectResponse, error) { |
| 998 | sd, err := s.getSnapshotData(params.Snapshot) |
| 999 | if err != nil { |
| 1000 | return nil, err |
| 1001 | } |
| 1002 | |
| 1003 | uri := params.File.ToURI(s.projectSession.GetCurrentDirectory()) |
| 1004 | proj := sd.snapshot.GetDefaultProject(uri) |
| 1005 | if proj == nil { |
| 1006 | return nil, nil |
| 1007 | } |
| 1008 | |
| 1009 | return NewProjectResponse(proj), nil |
| 1010 | } |
| 1011 | |
| 1012 | // handleParseConfigFile parses a tsconfig.json file and returns its contents. |
| 1013 | func (s *Session) handleParseConfigFile(ctx context.Context, params *ParseConfigFileParams) (*ConfigFileResponse, error) { |