diff --git a/language-server/src/main/java/com/as3mxml/vscode/providers/FormattingProvider.java b/language-server/src/main/java/com/as3mxml/vscode/providers/FormattingProvider.java index 54f546e93..ea17f0896 100644 --- a/language-server/src/main/java/com/as3mxml/vscode/providers/FormattingProvider.java +++ b/language-server/src/main/java/com/as3mxml/vscode/providers/FormattingProvider.java @@ -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; @@ -69,10 +70,20 @@ public List formatting(DocumentFormattingParams params, Canc MXMLTokenFormatter formatter = new MXMLTokenFormatter(settings); List 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 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();