toFileChangeSummary converts API file changes to a project.FileChangeSummary.
(changes *APIFileChanges)
| 2905 | |
| 2906 | // toFileChangeSummary converts API file changes to a project.FileChangeSummary. |
| 2907 | func (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. |
| 2937 | func (s *Session) handleGetSyntacticDiagnostics(ctx context.Context, params *GetDiagnosticsParams) ([]*DiagnosticResponse, error) { |
no test coverage detected