-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add Folder Lint Option to Right Click Folder Action Menu #199
Conversation
…t folder (the underlying code duplicates the confirmation modal code and slightly modifies the linting rule for all files for just the folder)
Thanks for the PR! I'm checking it out now. I'm having trouble finding the button is to lint folders, can you send a screenshot? Also it would be nice to have a command to lint files in the current folder. |
You need to right click on the folder to get it to to show up in the list. As far as adding the command goes, that should be relatively easy since it will just require a refactor to get the linting code reusable from both places. |
The command is now present. |
Please let me know if the command seems to act weird. |
src/main.ts
Outdated
console.log('Linting folder ' + folder.name); | ||
let lintedFiles = 0; | ||
await Promise.all(this.app.vault.getMarkdownFiles().map(async (file) => { | ||
if (file.path.startsWith(folder.path) && !this.shouldIgnoreFile(file)) { |
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.
when I lint the folder named Test
it also lints files starting with Test
like Testing.md which it shouldnt
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 should be taken care of with the latest commit.
I dont know a better way
Yeah it would be nice to reuse code there. Maybe a more generic Modal class? I'm ok with leaving it as is though.
Why are folders with 1 file special?
I think its a good idea since users wont be able to see the files being linted when they run it.
Makes sense.
Could you document this feature to the README? Just a sentence or two in the usage section. Make sure to add it in the readme_template and not the README.md since its generated.
Thanks for the contribution, it looks basically good to me! Just noticed one bug that should be a quick fix |
…ntation image showing the ability to get the lint folder option in the right click menu
The special case I was referring to in with 1 file is that when it gets done linting it will say "All 1 files in FOLDER_NAME". I am not sure if there is a different set of wording we would like. However, I was able to make the modal generic and be used by both. I updated the README template to include the info and to update the contribution steps to include the mentioning of forking the repo since one cannot update this repo directly by default. |
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
@platers
Fixes #177
I essentially duplicated the confirmation model and changed a few things as well as making sure that the event action would be added to the drop down menu when your right click a folder.
I have a couple of questions regarding how things were done here and whether I should go ahead and try to change a few things:
Thanks for the guidance on this. I am hoping this will benefit those that use the plugin and hopefully be straight forward in the code.