MCPcopy Create free account
hub / github.com/microsoft/typescript-go / handleGetDefaultProjectForFile

Method handleGetDefaultProjectForFile

internal/api/session.go:997–1010  ·  view source on GitHub ↗

handleGetDefaultProjectForFile returns the default project for a given file, or nil if no project currently contains the file.

(ctx context.Context, params *GetDefaultProjectForFileParams)

Source from the content-addressed store, hash-verified

995// handleGetDefaultProjectForFile returns the default project for a given file,
996// or nil if no project currently contains the file.
997func (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.
1013func (s *Session) handleParseConfigFile(ctx context.Context, params *ParseConfigFileParams) (*ConfigFileResponse, error) {

Calls 5

getSnapshotDataMethod · 0.95
NewProjectResponseFunction · 0.85
ToURIMethod · 0.80
GetCurrentDirectoryMethod · 0.65
GetDefaultProjectMethod · 0.65