You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2021/01/23 16:05:28 UTC
[netbeans] branch master updated: [NETBEANS-5118] Fixing
computation of effective text block content when the text block contains
empty lines.
This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 87f98a1 [NETBEANS-5118] Fixing computation of effective text block content when the text block contains empty lines.
new 9c29685 Merge pull request #2593 from jlahoda/NETBEANS-5118
87f98a1 is described below
commit 87f98a192e2346f10d043bda3028e1e833682305
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Mon Dec 14 07:01:47 2020 +0100
[NETBEANS-5118] Fixing computation of effective text block content when the text block contains empty lines.
---
.../base/semantic/SemanticHighlighterBase.java | 1 +
.../java/editor/base/semantic/DetectorTest.java | 29 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
index 9c509e6..bf223b2 100644
--- a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
+++ b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java
@@ -979,6 +979,7 @@ public abstract class SemanticHighlighterBase extends JavaParserResultTask {
String tokenText = t.text().toString();
String[] lines = tokenText.split("\n");
int indent = Arrays.stream(lines, 1, lines.length)
+ .filter(l -> !l.trim().isEmpty())
.mapToInt(this::leadingIndent)
.min()
.orElse(0);
diff --git a/java/java.editor.base/test/unit/src/org/netbeans/modules/java/editor/base/semantic/DetectorTest.java b/java/java.editor.base/test/unit/src/org/netbeans/modules/java/editor/base/semantic/DetectorTest.java
index 6e8ba00..916e0f0 100644
--- a/java/java.editor.base/test/unit/src/org/netbeans/modules/java/editor/base/semantic/DetectorTest.java
+++ b/java/java.editor.base/test/unit/src/org/netbeans/modules/java/editor/base/semantic/DetectorTest.java
@@ -632,12 +632,12 @@ public class DetectorTest extends TestBase {
public void testRawStringLiteral() throws Exception {
try {
- SourceVersion.valueOf("RELEASE_13");
+ SourceVersion.valueOf("RELEASE_15");
} catch (IllegalArgumentException iae) {
//OK, presumably no support for raw string literals
return ;
}
- setSourceLevel("13");
+ setSourceLevel("15");
performTest("RawStringLiteral",
"public class RawStringLiteral {\n" +
" String s1 = \"\"\"\n" +
@@ -754,6 +754,31 @@ public class DetectorTest extends TestBase {
"[PRIVATE, METHOD, DECLARATION], 17:25-17:29");
}
+ public void testRawStringLiteralNETBEANS_5118() throws Exception {
+ try {
+ SourceVersion.valueOf("RELEASE_15");
+ } catch (IllegalArgumentException iae) {
+ //OK, presumably no support for raw string literals
+ return ;
+ }
+ setSourceLevel("15");
+ performTest("RawStringLiteral",
+ "public class RawStringLiteral {\n" +
+ " String s1 = \"\"\"\n" +
+ " int i1 = 1; \n" +
+ "\n" +
+ " \n" +
+ " \t\n" +
+ " int i2 = 2;\n" +
+ " \"\"\";\n" +
+ "}\n",
+ "[PUBLIC, CLASS, DECLARATION], 0:13-0:29",
+ "[PUBLIC, CLASS], 1:4-1:10",
+ "[PACKAGE_PRIVATE, FIELD, DECLARATION], 1:11-1:13",
+ "[UNINDENTED_TEXT_BLOCK], 2:13-2:27",
+ "[UNINDENTED_TEXT_BLOCK], 6:13-6:29");
+ }
+
private void performTest(String fileName) throws Exception {
performTest(fileName, new Performer() {
public void compute(CompilationController parameter, Document doc, final ErrorDescriptionSetter setter) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists