-
Notifications
You must be signed in to change notification settings - Fork 29
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
Consolidate use of input box validation #3049
Conversation
window.showInputBox({ | ||
title, | ||
value | ||
}) | ||
|
||
export const getValidInput = ( | ||
const getValidInput = ( |
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.
[F] If we are concerned then I can try to find ~1 day to get these validators under test.
if (!includeZero) { | ||
return number > 0 | ||
} | ||
return number >= 0 |
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.
Not sure if it looks better but you could turn these four lines into one:
return includeZero ? number >= 0 : number > 0
extension/src/vscode/inputBox.ts
Outdated
window.showInputBox({ | ||
prompt: options?.prompt, | ||
title, | ||
validateInput, | ||
value: options?.value | ||
}) | ||
|
||
const isValid = ( |
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.
Should this function be isValidNumber
since the function is focused on checking numbers?
44e4f26
to
cdd6a02
Compare
Code Climate has analyzed commit c5f405a and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 45.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.4% (0.0% change). View more on Code Climate. |
2/2
main
<- #3048 <- thisThis PR consolidates our use of validation functions with respect to the VS Code
InputBox
.Demo
Screen.Recording.2023-01-04.at.4.21.38.pm.mov