@@ -63,11 +63,9 @@ func parseAndEmitDiagnostics(
6363 for diagnostic in diagnostics {
6464 let location = diagnostic. location ( converter: expectedConverter)
6565
66- // Downgrade editor placeholders to warnings , because it is useful to support formatting
66+ // Ignore editor placeholders, because it is useful to support formatting
6767 // in-progress files that contain those.
68- if diagnostic. diagnosticID == StaticTokenError . editorPlaceholder. diagnosticID {
69- parsingDiagnosticHandler ( downgradedToWarning ( diagnostic) , location)
70- } else {
68+ if diagnostic. diagnosticID != StaticTokenError . editorPlaceholder. diagnosticID {
7169 parsingDiagnosticHandler ( diagnostic, location)
7270 hasErrors = true
7371 }
@@ -79,29 +77,3 @@ func parseAndEmitDiagnostics(
7977 }
8078 return sourceFile
8179}
82-
83- // Wraps a `DiagnosticMessage` but forces its severity to be that of a warning instead of an error.
84- struct DowngradedDiagnosticMessage : DiagnosticMessage {
85- var originalDiagnostic : DiagnosticMessage
86-
87- var message : String { originalDiagnostic. message }
88-
89- var diagnosticID : SwiftDiagnostics . MessageID { originalDiagnostic. diagnosticID }
90-
91- var severity : DiagnosticSeverity { . warning }
92- }
93-
94- /// Returns a new `Diagnostic` that is identical to the given diagnostic, except that its severity
95- /// has been downgraded to a warning.
96- func downgradedToWarning( _ diagnostic: Diagnostic ) -> Diagnostic {
97- // `Diagnostic` is immutable, so create a new one with the same values except for the
98- // severity-downgraded message.
99- return Diagnostic (
100- node: diagnostic. node,
101- position: diagnostic. position,
102- message: DowngradedDiagnosticMessage ( originalDiagnostic: diagnostic. diagMessage) ,
103- highlights: diagnostic. highlights,
104- notes: diagnostic. notes,
105- fixIts: diagnostic. fixIts
106- )
107- }
0 commit comments