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

Method toFileChangeSummary

internal/api/session.go:2907–2934  ·  view source on GitHub ↗

toFileChangeSummary converts API file changes to a project.FileChangeSummary.

(changes *APIFileChanges)

Source from the content-addressed store, hash-verified

2905
2906// toFileChangeSummary converts API file changes to a project.FileChangeSummary.
2907func (s *Session) toFileChangeSummary(changes *APIFileChanges) project.FileChangeSummary {
2908 if changes == nil {
2909 return project.FileChangeSummary{}
2910 }
2911 var summary project.FileChangeSummary
2912 if changes.InvalidateAll {
2913 summary.InvalidateAll = true
2914 summary.IncludesWatchChangeOutsideNodeModules = true
2915 return summary
2916 }
2917 cwd := s.projectSession.GetCurrentDirectory()
2918 for _, doc := range changes.Changed {
2919 uri := doc.ToURI(cwd)
2920 summary.Changed.Add(uri)
2921 }
2922 for _, doc := range changes.Created {
2923 uri := doc.ToURI(cwd)
2924 summary.Created.Add(uri)
2925 }
2926 for _, doc := range changes.Deleted {
2927 uri := doc.ToURI(cwd)
2928 summary.Deleted.Add(uri)
2929 }
2930 if summary.Changed.Len()+summary.Created.Len()+summary.Deleted.Len() > 0 {
2931 summary.IncludesWatchChangeOutsideNodeModules = true
2932 }
2933 return summary
2934}
2935
2936// handleGetSyntacticDiagnostics returns syntactic diagnostics for a file or all files.
2937func (s *Session) handleGetSyntacticDiagnostics(ctx context.Context, params *GetDiagnosticsParams) ([]*DiagnosticResponse, error) {

Callers 1

handleUpdateSnapshotMethod · 0.95

Calls 4

ToURIMethod · 0.80
GetCurrentDirectoryMethod · 0.65
AddMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected