-
Notifications
You must be signed in to change notification settings - Fork 338
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
feat: colorize values of params #743
Conversation
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.
Great idea, this is much better. Thanks for posting a screenshot too!
Looks very promising! I'll take a look at the code tomorrow. |
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.
Good work, couple comments added 👍
@StefanDywersant, I've addressed the feedback. Colorizing is now optional as |
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.
I've dropped some comments but in general looks good.
I wish we could be a little bit smarter and try to modify the parameters as we construct the URLs, but unfortunately no URI Template library will allow us to do that. I guess we will have to go with what we have.
packages/cli/src/util/colorizer.ts
Outdated
transform: (aString: string) => string | ||
): string => { | ||
return path.replace(taggedParamsValues, transform('$2')); | ||
}).bind({}, new RegExp(`(${PRE_PARAM_VALUE_TAG},)(.*?)(,${POST_PARAM_VALUE_TAG})`, 'gm')); |
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.
Hmm maybe instead of binding you can just create the RegEx ahead of the time as a constant and use it in there — this should improve the readability.
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.
This is a super nice feature which will make people happier, good job!
I believe there might be a problem with complex styles and explode usage. Please see the comment. Also, it would be good to add a single end2end test at create server
level to ensure that the whole solution works.
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.
This is ok, but the final approval goes to @StefanDywersant
Co-Authored-By: Vincenzo Chianese <vincenz.chianese@icloud.com>
…into feature/colorize-params-values_
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.
I've tested locally the colorizing feature and it is cool, helpful and works perfectly!
I've added a few minor comments which, most of them you can just apply and let's merge this!
Again, a very good job @lag-of-death!
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 👍
Please go ahead and merge it! (I won't take the pleasure of hitting the green button from you like our captain does).
Closes #696
Checklist
What kind of change does this PR introduce?
feature
What is the current behavior? What is the new behavior?
Currently, values for params are in the same color the whole path is.
Now, the values are in bold and colored.
Does this PR introduce a breaking change?
No.