You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/09/17 21:02:03 UTC

[GitHub] [netbeans] Chris2011 opened a new pull request, #4649: Fix for not calling auto completion after end tag was already added

Chris2011 opened a new pull request, #4649:
URL: https://github.com/apache/netbeans/pull/4649

   right after opening tag, while copy and paste or closing tag token was added.
   
   The check was not proper enough for calling auto completion after end tag. It just checked the HtmlToken.TAG_CLOSE_SYMBOL which is also the one at the end of an ent tag </div">". So each time I copy and paste <div></div> it calles the auto completion which seemed wrong to me. See my screencapture:
   
   ![end-tag-code-completion](https://user-images.githubusercontent.com/795658/190876098-b529d20e-ca55-4e0f-9e76-1ce46e331d1a.gif)
   
   I changed that behaviour and now it always comes up at the end of an open tag. Not on an end tag or on a self closing tag like an image, which was already working before: 
   
   ![no-end-tag-code-completion](https://user-images.githubusercontent.com/795658/190876118-813bee90-69a3-496a-911e-f0a0f3ff1d26.gif)
   
   I will test this a couple of days to check whether there are other misbehavior or not and if there are no complaints I will merge this later by myself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on a diff in pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on code in PR #4649:
URL: https://github.com/apache/netbeans/pull/4649#discussion_r975682814


##########
ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java:
##########
@@ -386,7 +386,16 @@ public void run() {
                             } 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_OPEN, true, false,
+                                            HTMLTokenId.ARGUMENT,
+                                            HTMLTokenId.VALUE,
+                                            HTMLTokenId.VALUE_CSS,
+                                            HTMLTokenId.VALUE_JAVASCRIPT,
+                                            HTMLTokenId.OPERATOR,
+                                            HTMLTokenId.WS,
+                                            HTMLTokenId.EL_CLOSE_DELIMITER,
+                                            HTMLTokenId.EL_CONTENT,
+                                            HTMLTokenId.EL_OPEN_DELIMITER)) {

Review Comment:
   In general I like this - the current behavior annoyed the hell out of me. The second check looks to complex - If I understand correctly, you want to check if you are behind an open tag. I would invert this and check if it is not a closing tag. 
   
   ```suggestion
                                       if (!CharSequenceUtilities.equals("/>", ts.token().text()) && null == LexerUtils.followsToken(ts, HTMLTokenId.TAG_CLOSE, true, false,
                                               HTMLTokenId.WS,
                                               HTMLTokenId.TAG_CLOSE_SYMBOL)) {
   ```
   
   The idea here is, that the definition for a closing tag is pretty simple: https://www.w3.org/html/wg/spec/syntax.html#end-tags



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4649:
URL: https://github.com/apache/netbeans/pull/4649#discussion_r980392230


##########
ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java:
##########
@@ -386,7 +386,16 @@ public void run() {
                             } 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_OPEN, true, false,
+                                            HTMLTokenId.ARGUMENT,
+                                            HTMLTokenId.VALUE,
+                                            HTMLTokenId.VALUE_CSS,
+                                            HTMLTokenId.VALUE_JAVASCRIPT,
+                                            HTMLTokenId.OPERATOR,
+                                            HTMLTokenId.WS,
+                                            HTMLTokenId.EL_CLOSE_DELIMITER,
+                                            HTMLTokenId.EL_CONTENT,
+                                            HTMLTokenId.EL_OPEN_DELIMITER)) {

Review Comment:
   True, got it. Thx for the hint. I fixed and tested it. Worked as before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on a diff in pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on code in PR #4649:
URL: https://github.com/apache/netbeans/pull/4649#discussion_r976825381


##########
ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java:
##########
@@ -386,7 +386,16 @@ public void run() {
                             } 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_OPEN, true, false,
+                                            HTMLTokenId.ARGUMENT,
+                                            HTMLTokenId.VALUE,
+                                            HTMLTokenId.VALUE_CSS,
+                                            HTMLTokenId.VALUE_JAVASCRIPT,
+                                            HTMLTokenId.OPERATOR,
+                                            HTMLTokenId.WS,
+                                            HTMLTokenId.EL_CLOSE_DELIMITER,
+                                            HTMLTokenId.EL_CONTENT,
+                                            HTMLTokenId.EL_OPEN_DELIMITER)) {

Review Comment:
   The suggested check returns true if we are _not_ directly behind a closing tag. `null !=` would yield true after a closing tag, which is the opposite of what we want.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4649:
URL: https://github.com/apache/netbeans/pull/4649#discussion_r976132889


##########
ide/html.editor/src/org/netbeans/modules/html/editor/completion/HtmlCompletionProvider.java:
##########
@@ -386,7 +386,16 @@ public void run() {
                             } 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_OPEN, true, false,
+                                            HTMLTokenId.ARGUMENT,
+                                            HTMLTokenId.VALUE,
+                                            HTMLTokenId.VALUE_CSS,
+                                            HTMLTokenId.VALUE_JAVASCRIPT,
+                                            HTMLTokenId.OPERATOR,
+                                            HTMLTokenId.WS,
+                                            HTMLTokenId.EL_CLOSE_DELIMITER,
+                                            HTMLTokenId.EL_CONTENT,
+                                            HTMLTokenId.EL_OPEN_DELIMITER)) {

Review Comment:
   Shouldn't it be null !=... I thought it gives you the closing tag back, if the method finds it? But in general you are right, less checks etc. seems more performant and cleaner.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] Chris2011 commented on pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
Chris2011 commented on PR #4649:
URL: https://github.com/apache/netbeans/pull/4649#issuecomment-1262735978

   If failing travis is not a problem (I rerun them but still the same failing) and there are no other objections, I will merge this next week.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] Chris2011 merged pull request #4649: Fix for not calling auto completion after end tag was already added

Posted by GitBox <gi...@apache.org>.
Chris2011 merged PR #4649:
URL: https://github.com/apache/netbeans/pull/4649


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists