Skip to content

[NETBEANS-6196] Package code completion doesn't work in empty groovy … - #3316

Merged
sdedic merged 2 commits into
apache:masterfrom
ppisl:NETBEANS-6196
Nov 22, 2021
Merged

[NETBEANS-6196] Package code completion doesn't work in empty groovy …#3316
sdedic merged 2 commits into
apache:masterfrom
ppisl:NETBEANS-6196

Conversation

@ppisl

@ppisl ppisl commented Nov 12, 2021

Copy link
Copy Markdown
Member

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

@junichi11
junichi11 requested a review from sdedic November 13, 2021 04:53
@JaroslavTulach
JaroslavTulach self-requested a review November 15, 2021 09:46

@JaroslavTulach JaroslavTulach left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution Petr!

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

@sdedic sdedic Nov 15, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good idea. Do you want to do it in this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sdedic

sdedic commented Nov 16, 2021

Copy link
Copy Markdown
Member

Seems that Travis failures relate to 77cd083 (#2959) rather than this PR.

@sdedic
sdedic merged commit ae0b68e into apache:master Nov 22, 2021
@ebarboni ebarboni added this to the NB13 milestone Nov 22, 2021
@ppisl
ppisl deleted the NETBEANS-6196 branch November 24, 2021 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants