-
Notifications
You must be signed in to change notification settings - Fork 54
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
Separate HCL syntax into its own file #56
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.
In general we tend to treat HCL-based languages and HCL itself as separate languages entirely on the surface and keep the relationships/inheritance more as an implementation detail. I know in this case the HCL grammar is not strictly a generic enough HCL grammar today (it remains Terraform-specific) but I'd assume that is the hope for the future?
I guess a more radical (cleaner?) solution here would be to even have a separate repository HCL.tmLanguage
where HCL is the base and Terraform grammar is co-hosted there or remains in Terraform.tmLanguage
.
In other words, users of HCL-based languages who don't use Terraform should not need to know about Terraform, see anything Terraform related or install anything with Terraform in the name.
All that said I feel I would be asking for much more of your valuable contributor time than you may be willing to invest into this and so I will keep my comments/suggestions focused merely on the scope.
TL;DR Is there a reason we should be including both HCL and Terraform in the scope?
Maybe I don't fully understand your comments and also I certainly don't fully understand how tmLanguage syntaxes work but I don't think tmLanguage-based syntaxes can extend each other (I could be wrong). If that's the case then does that make your idea hard or impossible to do? I guess the inheritance could still be done in the form of built-time syntax generation and result in duplicated code in each syntax but I'm not sure how would that be implemented and it sounds like too much effort for me.
You are talking about tmLanguage but I'm only handling sublime-syntax variants here. So in that case would you suggest creating |
There are some ways to inherit between TM grammars "natively" but they're not very intuitive nor flexible and we abandoned attempts of using it very early on. I don't know enough about Sublime syntax grammars to suggest if there is anything comparable.
That is exactly what we do for our TM grammars and totally understandable that would be quite a lot of effort. I was merely suggesting that regardless of the exact grammar rules being Terraform specific, we can report
I am talking about both actually since the PR is modifying # - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault
# https://www.vaultproject.io/docs/configuration/ i.e. Vault configuration file should not be reported as scope that has "terraform" in the name, I think, regardless of how exactly the highlighting grammar works. I hope that answers your questions, I will try to stay available on the Sublime Text Discord in the coming days in case you want to clarify/discuss this further in a more synchronous way. |
One more point of clarification: I would be open to |
I've renamed the file to I agree that |
As far as CI being stuck, maybe https://github.com/alexlouden/Terraform.tmLanguage/blob/7faec10b4057b95bff82fb585730e560871d26c4/.github/workflows/ci.yaml#L15 should be changed to |
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.
This now LGTM, happy to merge once CI is green (hopefully just a matter of rebasing)
* upstream/master: github: bump linux version to latest
Thanks for the PR, I will look into cutting a release hopefully today (with this change). |
Per discussions in sublimelsp/LSP-terraform#26 and in #48 I've extracted support for
.hcl
files into a dedicated syntax that inherits the main syntax.The point of it is to make
.hcl
extension not be handled by the main syntax so that it doesn't get the samesource.terraform
scope but a dedicatedsource.terraform-hcl
source.hcl
scope. This is required for Sublime LSP as it enables language server based on the scope and it isn't possible to exclude.hcl
from starting the server otherwise.tm-language syntax is unaffected.
Resolves sublimelsp/LSP-terraform#26
Resolves #48
@radeksimko