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 completion within locals #1586

Open
13 tasks
radeksimko opened this issue Jan 18, 2024 · 0 comments
Open
13 tasks

Improve completion within locals #1586

radeksimko opened this issue Jan 18, 2024 · 0 comments
Labels

Comments

@radeksimko
Copy link
Member

radeksimko commented Jan 18, 2024

Background

The locals block is somewhat unique compared to the rest of the language in that it has cty.DynamicPseudoType constraint, i.e. any type and allows interpolation.

We currently provide very basic completion inside of locals right after the = which brings up all functions and references.

We do not provide completion in many other contexts which may be relevant

  • boolean (true / false)
  • maps (+ inside keys and values)
  • objects (+ inside attribute names and values)
  • tuples (+ elements)
  • lists (+ elements)
  • sets (+ elements)

2024-01-18 09 46 03

Proposal

  • Enable completion for boolean, i.e. true and false
  • Enable completion for new objects, i.e. { ... }
  • Enable completion inside object attribute names, i.e. { (HERE) = "foo" }
  • Enable completion inside object attribute values, i.e. { foo = HERE }
  • Enable completion for new maps, i.e. tomap({ ... })
  • Enable completion inside map keys, i.e. { (HERE) = "foo" }
  • Enable completion inside map values, i.e. { foo = HERE }
  • Enable completion for new tuples, i.e. [ ... ]
  • Enable completion inside tuples, i.e. [ HERE, HERE, ... ]
  • Enable completion for new sets, i.e. toset([ ... ])
  • Enable completion inside sets, i.e. toset([ HERE, HERE, ... ])
  • Enable completion for new lists, i.e. tolist([ ... ])
  • Enable completion inside lists, i.e. tolist([ HERE, HERE, ... ])

Implementation Notes

This can be more broadly described as completion inside of an attribute with the following constraint:

schema.AnyExpression{
  OfType: cty.DynamicPseudoType,
}

i.e. this is relevant for any other language and other parts of the Terraform language which may satisfy the above, not just locals.

@radeksimko radeksimko changed the title Improve completion within locals Improve completion / hover / semantic tokens within locals Jan 18, 2024
@radeksimko radeksimko added textDocument/hover textDocument/semanticTokens Semantic syntax highlighting and removed textDocument/hover textDocument/semanticTokens Semantic syntax highlighting labels Jan 18, 2024
@radeksimko radeksimko changed the title Improve completion / hover / semantic tokens within locals Improve completion within locals Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant