-
Notifications
You must be signed in to change notification settings - Fork 24
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
Prefill Required Fields on Completion #89
Conversation
0cb8396
to
7ce71de
Compare
7ce71de
to
05d4c93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the completion of blocks I only have very minor stylistic suggestions. The PR overall looks pretty good! Well done.
4606715
to
f75873e
Compare
4abe8f8
to
86c2c23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just left some very minor suggestions, but none of them are blocking.
193e439
to
0286430
Compare
On block completion, provide a snippet that completes the label and also the required fields for that block. Currently users can introduce a new block into their configuration using our auto-complete snippet. This snippet only provides the lable name and completes the stanza. However the block is not considered complete/valid until it has all required attributes and blocks. This means that users have to either scroll over a potentially long list of attributes and blocks to add all required ones and/or consult documentation in a separate window. This commit modifies the label completion logic to provide an auto-complete snippet that lists all required fields (attributes and blocks) and expands the TextEdit range to the entire line instead of just to the tabstop. This will replace the entire line with the chosen snippet. The attributes and blocks are sorted alphabetically to ensure consistent ordering for each invocation. For example, when completing the `aws_appmesh_route` resource type, the `mesh_name`, `name`, `virtual_router_name` attributes and the `spec` block will fill in on accepting the completion. Then, the user can tab through to enter in the appropriate value for each field. ``` resource "aws_appmesh_route" "{2:name}" { mesh_name = "${3:value}" name = "${4:value}" virtual_router_name = "${:value}" spec { } ${0} } ```
0286430
to
f22d3c2
Compare
On block completion, provide a snippet that completes the label and also the required fields for that block.
Currently users can introduce a new block into their configuration using our auto-complete snippet. This snippet only provides the label name and completes the stanza. However the block is not considered complete/valid until it has all required attributes and blocks. This means that users have to either scroll over a potentially long list of attributes and blocks to add all required ones and/or consult documentation in a separate window.
This commit modifies the label completion logic to provide an auto-complete snippet that lists all required fields (attributes and blocks) and expands the TextEdit range to the entire line instead of just to the tabstop. This will replace the entire line with the chosen snippet. The attributes and blocks are sorted alphabetically to ensure consistent ordering for each invocation.
For example, when completing the
aws_appmesh_route
resource type, themesh_name
,name
,virtual_router_name
attributes and thespec
block will fill in on accepting the completion. Then, the user can tab through to enter in the appropriate value for each field.Enabled in LS in hashicorp/terraform-ls#657
Surfaced in VS Code in hashicorp/vscode-terraform#799 as an experimental feature
Completes hashicorp/vscode-terraform#719