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 UX of completion items #115

Merged
merged 2 commits into from
May 26, 2020
Merged

Improve UX of completion items #115

merged 2 commits into from
May 26, 2020

Conversation

paultyng
Copy link
Contributor

@paultyng paultyng commented May 24, 2020

Move descriptions to the documentation field, update to terraform-json 0.5.0 that has additional description support, etc.

Using the documentation instead of detail gives it a better look in VS Code at least:

image
(my misspelling aside)

@paultyng
Copy link
Contributor Author

I'm not sure why the unit test isn't passing, there is something happening in the mock server I think that isn't replicating the normal behavior, as I see the documentation data coming through in the UI.

@paultyng
Copy link
Contributor Author

Without markdown support in the LS protocol, we may want to convert markdown to plain text in the near term, not sure. I'll open an issue for markdown support.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like these changes and I think it's almost ready for merge, besides that one failing test.

Without markdown support in the LS protocol, we may want to convert markdown to plain text in the near term, not sure. I'll open an issue for markdown support.

If the markdown format becomes the only format for descriptions then we'd definitely need a way of stripping off the markdown somehow, because markdown is opt-in by client per LSP, so we will always need to have a plaintext version for clients that don't support markdown.

It makes me think we probably should have implemented this as dual (plaintext/markdown) fields in the protocol, instead of 1 fields with another one specifying whether it's plaintext or markdown. I'm not sure how well we can turn markdown into plaintext if it contains anything else than inline formatting. Block-based formatting (like heading or ```) will certainly loose meaning and probably mess up something.

internal/terraform/lang/resource_block.go Outdated Show resolved Hide resolved
internal/terraform/lang/schema.go Show resolved Hide resolved
requiredText := "Required"
if len(blockType.BlockList) >= int(blockS.MinItems) {
requiredText = "Optional"
detail := fmt.Sprintf("Block, %s", blockS.NestingMode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon we'll iterate on the human-readable text here over time to e.g. print list of blocks, single block etc. but this is already big step forward and I like these changes 👍 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, just wanted to move closer to core concepts.

internal/terraform/schema/schema_storage.go Show resolved Hide resolved
langserver/handlers/complete_test.go Show resolved Hide resolved
@@ -34,6 +34,9 @@ func CompletionItem(candidate lang.CompletionCandidate, pos hcl.Pos, snippetSupp
Kind: lsp.CIKField,
InsertTextFormat: lsp.ITFSnippet,
Detail: candidate.Detail(),
// TODO: deprecated / tags?
// TODO: markdown handling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it's safe to say this will always be plaintext until SDK actually allows providers to declare anything else, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the markdown support should be RFCd properly, discussed with the SDK team and it may require further changes in the protocol as mentioned.

@paultyng paultyng force-pushed the documentation branch 2 times, most recently from 627963b to 4277725 Compare May 26, 2020 15:02
Move descriptions to the documentation field, update to terraform-json 0.5.0 that has additional description support, etc.
@paultyng
Copy link
Contributor Author

@radeksimko I reworked the PR to surface the distinction more cleanly in line with what the LSP protocol should be in the future. Let me know your thoughts.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: 👍

@radeksimko radeksimko merged commit 720244a into master May 26, 2020
@radeksimko radeksimko deleted the documentation branch May 26, 2020 15:13
@ghost
Copy link

ghost commented Jun 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants