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

Method handleGetSourceFileNames

internal/api/session.go:1080–1097  ·  view source on GitHub ↗

handleGetSourceFileNames returns file names of all source files in a project.

(ctx context.Context, params *GetSourceFileNamesParams)

Source from the content-addressed store, hash-verified

1078
1079// handleGetSourceFileNames returns file names of all source files in a project.
1080func (s *Session) handleGetSourceFileNames(ctx context.Context, params *GetSourceFileNamesParams) ([]string, error) {
1081 sd, err := s.getSnapshotData(params.Snapshot)
1082 if err != nil {
1083 return nil, err
1084 }
1085
1086 program, err := sd.getProgram(params.Project)
1087 if err != nil {
1088 return nil, err
1089 }
1090
1091 sourceFiles := program.GetSourceFiles()
1092 result := make([]string, len(sourceFiles))
1093 for i, sourceFile := range sourceFiles {
1094 result[i] = sourceFile.FileName()
1095 }
1096 return result, nil
1097}
1098
1099// handleGetSourceFileMetadata returns program-stored metadata for a single source file.
1100// The client fetches this lazily per file and caches it.

Callers 1

HandleRequestMethod · 0.95

Calls 6

getSnapshotDataMethod · 0.95
lenFunction · 0.85
getProgramMethod · 0.65
GetSourceFilesMethod · 0.65
FileNameMethod · 0.65
makeFunction · 0.50

Tested by

no test coverage detected