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

Provide completion in "invalid" ConditionalExpr #348

Open
Tracked by #326
radeksimko opened this issue Nov 27, 2023 · 0 comments
Open
Tracked by #326

Provide completion in "invalid" ConditionalExpr #348

radeksimko opened this issue Nov 27, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@radeksimko
Copy link
Member

radeksimko commented Nov 27, 2023

Background

While implementing support for ConditionalExpr in #326 a few edge cases surfaced around completion:

  • incomplete ConditionalExpr
    • attr = /*HERE*/ ? var.foo : var.bar
    • attr = var.foo ? /*HERE*/ : var.bar
    • attr = var.foo ? var.bar : /*HERE*/
    • attr = var.foo ? /*HERE*/
  • "impeding" incomplete Traversal (with trailing dot) inside otherwise complete ConditionalExpr
    • attr = var. ? var.foo : var.bar
    • attr = var.foo ? var. : var.bar
    • attr = var.foo ? var.bar : var.

In all of the above cases we're unable to provide any completion primarily because the upstream HCL parser is thrown off by the invalid stuff so much that it does not return the attribute at all, let alone partial expression.

Proposal

Investigate either changes upstream in HCL or some form of recovery downstream here in hcl-lang that would enable completion in the above contexts.

Upstream Issue

hashicorp/hcl#643

@radeksimko radeksimko added the enhancement New feature or request label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant