-
Notifications
You must be signed in to change notification settings - Fork 48
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: Support configurable location for creating notes #331
Conversation
Thanks for the contribution! 💙I'll have a look next week. |
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.
Thanks for your patience.
I tested this feature on MacOS, and it works with short refs, I don't have Windows at the moment to check if it works there as well (tests seem to pass, though).
I also left some ideas and comments for improvements.
// Apply default folder rule if it's a short ref(i.e. doesn't have an existing dir in ref). | ||
const defaultPath = | ||
paths.length === 1 | ||
? getMemoConfigProperty('files.defaultPaths', []).find((rule) => |
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 to validate that rules config conforms to the expected format when Memo extension is initialized or this property changed, otherwise it can lead to unexpected runtime exceptions.
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.
What kind of validation/runtime exception do you have on your mind?
I couldn't think of any meaningful check actually -- not anything that could prevent a runtime error
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.
Maybe validating that rule and folder are strings and defined, because anything can be passed by user.
At least wrapping it into try catch and reporting it using an error popup with some meaningful description might be better to not break links creation.
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.
It seems that vscode does not provide any schema for array props, so perhaps should be done manually.
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.
Try catch added.
Any suggestion validating the schema? It seems to be just convenient(and idiomatic) to just do type assertion for settings?
Codecov Report
@@ Coverage Diff @@
## master #331 +/- ##
=========================================
Coverage ? 91.85%
=========================================
Files ? 21
Lines ? 921
Branches ? 211
=========================================
Hits ? 846
Misses ? 74
Partials ? 1
Continue to review full report at Codecov.
|
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 don't have a Windows VM atm to check if it works there as well. Do you have Windows? It would be great to check that this feature works there, especially such paths "folder": "/Notes"
, sometimes tests are not super reliable way to prove something works with Windows.
Co-authored-by: Svyat Sobol <[email protected]>
Sorry I was busy lately. I don't have a windows as well. Sorry. |
It was busy time for me as well, thanks for considering all comments! |
#38
My apologize in advance -- I'm not fluent in TS. Please just let me know if I'm making any dumb mistake.
Thanks.