vscode-terraform
vscode-terraform copied to clipboard
Completions: Recover partially typed provider defined functions after the first colon has been typed
Extension Version
n/a
Problem Statement
When parsing Terraform config which includes partial provider defined functions (e.g. provider::aws::a or provider:), the HCL parser returns an empty expression for these parts. This has the effect that we can't give completions for matching provider defined functions after the user typed the first :.
Currently, provider defined functions are only suggested while the initial provider string is typed because that's when the parser will still return a traversal expression. As soon as the first : is included in the string it can't be a valid traversal anymore and no expression is returned by the parser.
Expected User Experience
Completion suggestions are shown for any prefix of a provider defined function that may be typed.
Proposal
Recover provider defined function calls when the expression is nil. This can probably be done by looking backwards and confirming that the beginning of all previous [\w-_:] characters starts with provider: (as before that the parser will still return an already handled traversal expression).
References
- #1674
Help Wanted
- [X] I'm interested in contributing a fix myself
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment