Skip to content

Commit

Permalink
language-server: FormattingProvider prints unexpected exception probl…
Browse files Browse the repository at this point in the history
…ems to stderr so that they are more likely to be reported as bugs
  • Loading branch information
joshtynjala committed Dec 9, 2024
1 parent 1b8aadc commit f1f5ddd
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.apache.royale.compiler.config.ConfigurationPathResolver;
import org.apache.royale.compiler.problems.ICompilerProblem;
import org.apache.royale.compiler.problems.UnexpectedExceptionProblem;
import org.apache.royale.formatter.ASTokenFormatter;
import org.apache.royale.formatter.FormatterSettings;
import org.apache.royale.formatter.FormatterUtils;
Expand Down Expand Up @@ -69,10 +70,20 @@ public List<? extends TextEdit> formatting(DocumentFormattingParams params, Canc
MXMLTokenFormatter formatter = new MXMLTokenFormatter(settings);
List<ICompilerProblem> problems = new ArrayList<>();
formattedFileText = formatter.format(path.toString(), fileText, problems);
for (ICompilerProblem problem : problems) {
if (problem instanceof UnexpectedExceptionProblem) {
System.err.println(problem);
}
}
} else if (path.toString().endsWith(FILE_EXTENSION_AS)) {
ASTokenFormatter formatter = new ASTokenFormatter(settings);
List<ICompilerProblem> problems = new ArrayList<>();
formattedFileText = formatter.format(path.toString(), fileText, problems);
for (ICompilerProblem problem : problems) {
if (problem instanceof UnexpectedExceptionProblem) {
System.err.println(problem);
}
}
}
if (fileText.equals(formattedFileText)) {
return Collections.emptyList();
Expand Down

0 comments on commit f1f5ddd

Please sign in to comment.