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

Navigator Support for HCL Files #5954

Merged
merged 6 commits into from
May 21, 2023
Merged

Conversation

lkishalmi
Copy link
Contributor

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.

@lkishalmi lkishalmi added the HCL label May 15, 2023
@lkishalmi lkishalmi added this to the NB19 milestone May 15, 2023
@lkishalmi
Copy link
Contributor Author

image

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a 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).

@lkishalmi
Copy link
Contributor Author

@matthiasblaesing Thank you for the insightful review!

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

The update looks good. Thank you. One thing I noticed while testing was this:

image

Is the red underlining intentional? If so, a tooltip or info bubble would be helpful to understand it.

@lkishalmi
Copy link
Contributor Author

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!

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a 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.

@lkishalmi lkishalmi merged commit e7a5419 into apache:master May 21, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants