Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Nov 22, 2021

Conversation

ppisl
Copy link
Member

@ppisl ppisl commented Nov 12, 2021

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

Copy link

@JaroslavTulach JaroslavTulach left a comment

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
Copy link
Member

@sdedic sdedic Nov 15, 2021

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
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
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
Copy link
Member

sdedic commented Nov 16, 2021

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.

None yet

5 participants