Pre-fill required registry module inputs on source completion #1029
Labels
enhancement
New feature or request
modules
Functionality related to the module block and modules generally
needs-research
textDocument/completion
Background
As part of #869 we introduced completion for registry module sources. The first version of the issue included resolving module inputs as well. After attempting this and running into a couple of nontrivial problems, we created this follow-up issue.
When a user requests auto-completion inside a module source, we send a search request to Algolia, returning all the matching modules. Furthermore, on selecting a completion item, VS Code will send a resolve request to the LS, which we intend to use for enriching the item with the module inputs fetched from the TF registry.
Expected User Experience
Fill the required module inputs when completing the module source:
Provide a similar experience as for resources:
This includes:
editor.suggest.preview
enabledChallenges / Findings
insertTextFormat
for thetextEdit
of aCompletionItem
, it's ignored foradditionalTextEdits
. Without it, VS Code won't render any tabstops/placeholders.completionItem/resolve
request can only update the following three properties:documentation
,detail
,additionalTextEdits
textEdit
when resolving an item, all information must be part of the initialtextDocument/completion
requesteditor.suggest.preview
feature only shows modifications done by thetextEdit
and doesn't show any modifications done byadditionalTextEdits
Proposal
hashicorp/hcl-lang
To be able to build the
additionalTextEdits
, we need more context inside the resolve hook:UnresolvedCandidate
textEdit
)hashicorp/terraform-ls
ResolveRegistryModuleSource
hookCompletionItemResolve
handler to add more context to theUnresolvedCandidate
Additional context / links
The text was updated successfully, but these errors were encountered: