diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/AnnotateDiagnostics.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/AnnotateDiagnostics.java index 918197cb6722..919e14174641 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/AnnotateDiagnostics.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/utils/AnnotateDiagnostics.java @@ -80,7 +80,8 @@ private static String diagnosticToString(Diagnostic diagnostic, boolean colorEna String color = SEVERITY_COLORS.get(severity); String message = diagnostic.toString().substring(severityString.length()); String code = diagnostic.diagnosticInfo().code(); - String formatString = getColoredString("%s", color, colorEnabled) + "%s (%s)"; + boolean isMultiline = diagnostic.message().contains("\n"); + String formatString = getColoredString("%s", color, colorEnabled) + "%s" + (isMultiline ? "\n(%s)" : " (%s)"); return String.format(formatString, severityString, message, code); } diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt index 10f97cb46a11..2c2de9e12b96 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt index 55fbccbf4a4a..4e90569f1e79 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable bar.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt index 076d9df06c38..243a73fc432e 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable foo.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt index ed846965f54f..b91445c7aa0b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt @@ -5,6 +5,7 @@ WARNING [Ballerina.toml:(1:1,1:1)] missing table '[package]' in 'Ballerina.toml' org = "john" name = "validProjectWithEmptyBallerinaToml" version = "0.1.0" +(BCE5001) Generating executable target/bin/validProjectWithEmptyBallerinaToml.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt index 242b9d8033e4..f0098abf2f41 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt @@ -1,4 +1,8 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt index 748e446c1e67..a69eff61ff8b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt @@ -1,3 +1,7 @@ Compiling source foo/winery:0.1.0 -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt index 2c5b1c6c542c..8d71bbfcda15 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt index 10f97cb46a11..2c2de9e12b96 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt index 55fbccbf4a4a..4e90569f1e79 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable bar.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt index 076d9df06c38..243a73fc432e 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable foo.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt index 944bda503633..2eb7ac0fbc21 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt @@ -5,6 +5,7 @@ WARNING [Ballerina.toml:(1:1,1:1)] missing table '[package]' in 'Ballerina.toml' org = "john" name = "validProjectWithEmptyBallerinaToml" version = "0.1.0" +(BCE5001) Generating executable target\bin\validProjectWithEmptyBallerinaToml.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt index 242b9d8033e4..f0098abf2f41 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt @@ -1,4 +1,8 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt index 748e446c1e67..a69eff61ff8b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt @@ -1,3 +1,7 @@ Compiling source foo/winery:0.1.0 -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt index 2c5b1c6c542c..8d71bbfcda15 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar