-
Notifications
You must be signed in to change notification settings - Fork 874
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
Navigator Support for HCL Files #5954
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few inline comments.
What would be good is addition of unittests. I come from the CSS/JS side and it is totally helpful there, that there are tests, that just dump the detected structure and compare with the known good result. One problem that would most probably have been caught if there would have been a structure dump is the broken offset detection in (ASTBuilderListener).
ide/languages.hcl/src/org/netbeans/modules/languages/hcl/HCLStructureItem.java
Outdated
Show resolved
Hide resolved
ide/languages.hcl/src/org/netbeans/modules/languages/hcl/HCLStructureItem.java
Outdated
Show resolved
Hide resolved
ide/languages.hcl/src/org/netbeans/modules/languages/hcl/ast/ASTBuilderListener.java
Outdated
Show resolved
Hide resolved
@matthiasblaesing Thank you for the insightful review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The red underlines are coming from the Lexer. Somehow I assigned the wrong coloring to the template content. Fixed in the last commit. Thanks for pointing that out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you.
Well, this one is a bit more than the Navogator.
The AST is kind of ready till Attribute level. Beyond that there is the HCL Expression sub-language which AST still has to be done.
That makes possible to implement the structure scanner part for Navigator.
I've realized that the HCL Expression language can be parsed by the HCL parser itself, no need to generate a separate HCLExpressionParser. That would just duplicate a lot of internal context classes, and so it would needed a duplicate implementation of the expression AST builder.
I plan to remove the Terraform specific Lexer in the future, as that is a duplicate + small addition to the HCLLexer. That is used in the basic syntax Highlight only. It would be better to replace that with parser assisted depending on HCL language flavors.