[NETBEANS-6196] Package code completion doesn't work in empty groovy … - #3316
Conversation
| if (ts.movePrevious()) { | ||
| while (ts.isValid() && ts.movePrevious() && ts.offset() >= 0) { | ||
| Token<GroovyTokenId> t = ts.token(); | ||
| if (!(t.id() == GroovyTokenId.NLS || t.id() == GroovyTokenId.WHITESPACE |
There was a problem hiding this comment.
This could be moved off to some utilities a a Predicate<Token<GroovyTokenId>> as I fear that whitespace-traversing code is on many places and does not take all the WS/comment tokens into account (see for example the package name back traversal code in this PR).
Edit: correction - there's some support already: see findPreviousNonWsNonComment, so maybe SH_COMMENT and SL_COMMENT the whitespace set should be added to the WS set there ?
There was a problem hiding this comment.
This is good idea. Do you want to do it in this PR?
There was a problem hiding this comment.
perhaps yes, but a possible retrofit of other code (that should use the helper instead of custom WS token checks) should be perhaps done separately. Your call.
This PR allow to complete package keyword in empty groovy file. Also after the package keyword the code completion offers only the packages.
Netbeans Issue: https://issues.apache.org/jira/browse/NETBEANS-6196