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

prettify optional fields in completion detail #737

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

zth
Copy link
Collaborator

@zth zth commented Feb 27, 2023

This prettifies how optional fields are printed in the completion detail.

Before:

someOptionalField: option<int>

After:

someOptionalField?: int

@zth zth requested a review from cristianoc February 27, 2023 20:01
(* Handle optional fields. Checking for "?" is because sometimes optional
fields are prefixed with "?" when completing, and at that point we don't
need to _also_ add a "?" after the field name, as that looks weird. *)
if optional && Utils.startsWith name "?" = false then
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: little code duplication in the if and else branch, perhaps better to unify, perhaps not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was being goal oriented 😉

@zth zth merged commit 1673527 into master Feb 28, 2023
@zth zth deleted the prettify-optional-fields-detail branch February 28, 2023 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants