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

Improve highlighting of built-in functions #28

Open
dbanck opened this issue Feb 4, 2022 · 1 comment
Open

Improve highlighting of built-in functions #28

dbanck opened this issue Feb 4, 2022 · 1 comment
Labels
enhancement New feature or request syntax

Comments

@dbanck
Copy link
Member

dbanck commented Feb 4, 2022

The current version of the Terraform language grammar contains a list of built-in functions. However, as we don't know which version of Terraform a user uses, it is highly possible that the list is either incomplete or contains removed functions.

https://github.com/hashicorp/vscode-terraform/blob/562c7cd7b27b5599b4fb1d4ae21b4fc63639dd91/syntaxes/terraform.tmGrammar.json#L750

To improve the syntax highlighting of built-in functions, we should remove the static list from the grammar file and use semantic token highlighting via the LS. The language server has a better understanding of which Terraform version is used and which functions are available in this version.

@dbanck dbanck added enhancement New feature or request syntax labels Feb 4, 2022
@radeksimko
Copy link
Member

Just wanted to add (as @jpogran proposed) that in addition to semantic token highlighting in LS we could also consider generating the grammar from a list of functions which would provide convenient way of highlighting correct function names.

This means however that we'd need to - (1) have the list of functions accessible somewhere (see hashicorp/terraform-ls#37 and/or TF-418), and (2) always reflect only the latest version of Terraform language in the grammar.

We could do something similar for variable types - with the same caveats as above.

That is not to propose this needs to be addressed together but just to add some context for posterity.

@radeksimko radeksimko transferred this issue from hashicorp/vscode-terraform Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax
Projects
None yet
Development

No branches or pull requests

2 participants