Skip to content

Conversation

zth
Copy link
Member

@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
Member 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