You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ch...@apache.org on 2022/10/10 17:34:51 UTC

[netbeans] branch master updated: Fix for not calling auto completion after end tag was already added (#4649)

This is an automated email from the ASF dual-hosted git repository.

chrizzly 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 781c6b1f9d Fix for not calling auto completion after end tag was already added (#4649)
781c6b1f9d is described below

commit 781c6b1f9d8c4d5f83a3de8f7579539915b44bf4
Author: Chrizzly <ch...@gmx.net>
AuthorDate: Mon Oct 10 19:34:44 2022 +0200

    Fix for not calling auto completion after end tag was already added (#4649)
    
    * Fix for not calling auto completion after end tag was already added
    right after opening tag
    
    * Change check for open tag to a simpler check for the closing tag
---
 .../modules/html/editor/completion/HtmlCompletionProvider.java     | 5 ++++-
 .../modules/html/editor/completion/HtmlCompletionQueryTest.java    | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java b/ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java
index 48b7fce64c..8f38113c45 100644
--- a/ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java
+++ b/ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java
@@ -386,7 +386,10 @@ public class HtmlCompletionProvider implements CompletionProvider {
                             } else {
                                 ts.move(dotPos - 1);
                                 if (ts.moveNext() || ts.movePrevious()) {
-                                    if (ts.token().id() == HTMLTokenId.TAG_CLOSE_SYMBOL && !CharSequenceUtilities.equals("/>", ts.token().text())) {
+                                    if (!CharSequenceUtilities.equals("/>", ts.token().text()) &&
+                                        null == LexerUtils.followsToken(ts, HTMLTokenId.TAG_CLOSE, true, false,
+                                            HTMLTokenId.WS,
+                                            HTMLTokenId.TAG_CLOSE_SYMBOL)) {
                                         ret[0] = true;
                                     }
                                 }
diff --git a/ide/html.editor/test/unit/src/org/netbeans/modules/html/editor/completion/HtmlCompletionQueryTest.java b/ide/html.editor/test/unit/src/org/netbeans/modules/html/editor/completion/HtmlCompletionQueryTest.java
index f058eb73ee..4ba2459d0b 100644
--- a/ide/html.editor/test/unit/src/org/netbeans/modules/html/editor/completion/HtmlCompletionQueryTest.java
+++ b/ide/html.editor/test/unit/src/org/netbeans/modules/html/editor/completion/HtmlCompletionQueryTest.java
@@ -69,6 +69,7 @@ public class HtmlCompletionQueryTest extends HtmlCompletionTestBase {
     public static Test suite() throws IOException, BadLocationException {
 	TestSuite suite = new TestSuite();
         suite.addTest(new HtmlCompletionQueryTest("testSimpleEndTagBeforeText"));
+        suite.addTest(new HtmlCompletionQueryTest("testNoAutocompletionAfterEndTag"));
         return suite;
     }
 
@@ -331,6 +332,12 @@ public class HtmlCompletionQueryTest extends HtmlCompletionTestBase {
         //test end tag ac for unknown tags
         assertItems("<div><bla>|", arr(), Match.EMPTY);
     }
+    
+    public void testNoAutocompletionAfterEndTag() throws BadLocationException, ParseException {
+        // Test for not calling auto completion after end tag is already added
+        assertItems("<div></div>|", arr(), Match.EMPTY);
+        assertItems("<img />|", arr(), Match.EMPTY);
+    }
 
     public void testJustBeforeTag() throws BadLocationException, ParseException {
         assertItems("<|<table>", arr("div"), Match.CONTAINS);


---------------------------------------------------------------------
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