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/03/21 21:35:03 UTC
[GitHub] [netbeans] ppisl commented on a change in pull request #3802: [NETBEANS-4826] Fixing java indexing in Groovy
ppisl commented on a change in pull request #3802:
URL: https://github.com/apache/netbeans/pull/3802#discussion_r831562838
##########
File path: groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/completion/util/CompletionContext.java
##########
@@ -298,19 +298,28 @@ private CaretLocation getCaretLocationFromRequest() {
boolean openBraceBeforePosition = false;
// is there package statement?
boolean afterPackagePosition = false;
-
+ boolean canBeImport = true;
+
ts.move(position);
while (ts.isValid() && ts.movePrevious() && ts.offset() >= 0) {
Token<GroovyTokenId> t = ts.token();
if (t.id() == GroovyTokenId.LBRACE) {
openBraceBeforePosition = true;
+ canBeImport = false;
} else if (t.id() == GroovyTokenId.LITERAL_class || t.id() == GroovyTokenId.LITERAL_interface || t.id() == GroovyTokenId.LITERAL_trait) {
classDefBeforePosition = true;
break;
} else if (t.id() == GroovyTokenId.LITERAL_package) {
afterPackagePosition = true;
break;
+ } else if (canBeImport && t.id() == GroovyTokenId.LITERAL_import) {
+ return CaretLocation.INSIDE_IMPORT;
+ }
+
+ if (canBeImport && !(t.id() == GroovyTokenId.DOT || t.id() == GroovyTokenId.IDENTIFIER
Review comment:
Can we have import statement like `import Whatever.class` ?
--
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