Closed ghost closed 9 years ago
Ok this is because Shiba tells chokidar to ignore dotfiles on watcher.ts#L70
It would be cool to be able to toggle this in config.yml
so users could set whether or not to watch dotfiles.
Thanks!!
Yeah, I added 'ignore_file_pattern'
config to config.yml
.
3896b3835396379be64a9a623fbeb750c45ec428
We can't know which file users want to ignore. (They also may want to ignore node_modules
) It should be controlled by users.
I renamed it to 'ignore_path_pattern'
because it matches to path (including directory), not file.
Wow this is great, thanks so much!! :tropical_drink:
After testing, this is not working. I tried the following lines in my config.yml
file and none worked:
ignore_path_pattern: '.git'
ignore_path_pattern: '/\.git/'
ignore_path_pattern: '[/\.git/]'
Am I entering the regex incorrectly? (I'm guessing so. I'm terrible with regex)
ignore_path_pattern: '/\.git/'
Sorry for confusing. It is a bit complicated. The string is passed to JavaScript's RegExp
's constructor. So, I think '/\\.git/'
is correct. I don't know spec of YAML so much...
Also, note that if I use double quotes instead of single quotes, Shiba tells me on commandline: No configuration file is found
Let me confirm a point. You mean that above 'No configuration file is found' error does not occur when using single quotes?
Please be sure to put config.yml
in ~/.config/Shiba
(I think already Shiba
directory is created).
You mean that above 'No configuration file is found' error does not occur when using single quotes?
Please ignore that. I made a mistake with regex which was causing the parser to consider the surrounding quotes as part of the regex, this was obviously problematic and caused the config file to fail loading.
Testing with: ignore_path_pattern: '/\\.git/'
does not work. :cry:
OK, I'll check it!
Shouldn't you pass the string directly to chokidar instead of creating a new RegExp
object? (pardon my poor knowledge of javascript)
When the value of ignored
is string
, chokidar seems to assume it as the path (See here).
So I think we must make an instance of RegExp
.
In my environment, below configuration works. (README.md
is watched, .foo.md
is watched and .git/foo.md
is not watched)
ignore_path_pattern: "/\\.git/"
Could you be sure that Shiba's version is v0.4.4?
Oooops. I am on 0.4.2. That's odd, because I updated Shiba right after I saw you create tag v0.4.4 however I wonder if npmjs.org is not serving 0.4.4?? Yep, just checked and it's on 0.4.2. npm is being lazy today. :zzz:
Hmm, travis builds have been erroring for a while now? https://travis-ci.org/rhysd/Shiba/builds
... probably not related.
Ah, that's right. But I have received an error as below on npm publish
. npm package already should be updated to 0.4.4...
npm ERR! publish Failed PUT 403
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "publish"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code E403
npm ERR! "You cannot publish over the previously published version 0.4.4." : shiba
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/rhayasd/Dev/github.com/rhysd/Shiba/npm-publish/npm-debug.log
Hmm, travis builds have been erroring for a while now?
I think it's not related to this issue. It failed to open window in Travis environment.
Anyway, I think we should wait a little. Thank you for your cooperation!
Ah ok. I will try some patience! :hourglass: Thanks for your help.
aaaand now it's 0.4.4. I'll update and test again.
Ok! 0.4.4 respects my setting of ignore_path_pattern: "/\\.git/"
however I noted these 2 problems when Shiba watches a dot-folder, or any child of a dot-folder:
adds
or any changes in other files.So for now, for my app I've moved my output to /tmp/AppName/output1.md
, /tmp/AppName/output2.md
, /tmp/AppName/output3.md
, etc. and Shiba has no trouble with watching all the documents in /tmp/AppName
and seeing the changes as they are made... it works great!! :smiley:
Sorry for late response. I'll check it.
I tried.
current dir --- .foo
|
|- animals.md
|
|- animals2.md
I prepared .foo
directory, animals.md
and animals2.md
. And I wrote below to config.yml
ignore_path_pattern: '/\\.git/'
I started Shiba and drag&drop animals.md
to the window. And then I edited animals.md
.
As the result, I confirmed that Shiba works well.
Could you tell me your detailed sequence?
Hopefully this explains my problem further:
When editing a document inside a hidden folder, Shiba stops updating the document after the 2nd or 3rd update. Normally if you edit the document in Vim, upon saving the document Shiba will see the file change and update the document. However, after the 2nd or 3rd save in VIm, Shiba stops updating the document. This only occurs for files which have a dot folder somewhere in the path.
Also, when editing a document that has a dot folder somewhere in the path, Shiba cannot see any file events so if you start editing a document within that folder Shiba is unable to see it, and will not switch to the most recently changed file.
Neither of these problems occur when there is no dot-folder in the file path.
Ah, sorry, I thought I wrote comment to this issue but I didn't...
Thank you for your detailed explanation.
I tried in above .foo
directly but I could not reproduce...
animals.md
by clicking paw icon in main window.animals2.md
by folder button.animals2.md
Using the currently available build from npm (0.4.4), this is what happens:
.foo
and animals.md
inside .foo
animals.md
with shiba and with vim:w
no update in shiba, requires manual refresh, shiba cannot see changesfoo
and leave animals.md
insideanimals.md
with shiba and vim:w
shiba can now see changes and automatically updatesOops didn't mean to close, pushed wrong button.
Thank you for the detailed sequence. I'll try it.
@xHN35RQ
I tried your sequence but 3.
still works well.
I took a screenshot.
It may be a Linux-specific fsevent problem. I'll check it with Ubuntu PC (I can't use Linux PC until next Thursday..)
Thanks @rhysd!
I tried below sequence with shiba v0.5.1 and Ubuntu 12.04. But it seems to work well...
current dir --- .foo
|
|- animals.md
ignore_path_pattern: '/\\.git/'
cd .foo
vim animals.md
shiba animals.md
animals.md
with Vim opened at 2.
.At 5., the preview was updated correctly.
I can confirm this worked! I did not have ignore_path_pattern: '/\\.git/'
in my config.yml
. I added that line, and now it works perfectly.
So without ignore_path_pattern: '/\\.git/'
in config.yml
Shiba cannot see changes in dot-folders.
Thanks once again for your help! :cake:
:tada:
Thank you for the confirmation.
In https://github.com/rhysd/Shiba/issues/10#issuecomment-142900717 you did the same as https://github.com/rhysd/Shiba/issues/10#issuecomment-133308065
So did I misunderstand something? Is Shiba default behavior to ignore hidden files?
Edit: ok it does ignore by default: https://github.com/rhysd/Shiba/commit/3896b3835396379be64a9a623fbeb750c45ec428
Odd, because I've tried before to use ignore_path_pattern: '/\\.git/'
with no success.
Yes, Shiba ignores dotfiles by default. This is a standard way when using chokidar.
Sometimes dotfiles directory has many files (e.g. .git
of large repository). Watching such a directory seems to pay cost. I think ignoring dotfiles helps to avoid the cost.
Well, thank you again for your help, and I'm sorry for causing all this extra work for you. I forgot to read the documentation after you updated on August 15.
No problem. You kindly reported many issues and they improved Shiba so much :smile:
Given a Markdown document inside a
.folder
Shiba cannot see any changes occuring to the document. Only on manual refresh can Shiba see the changes.For example: writing a temporary Markdown document to
~/.cache/AppName/output.md
this file can be opened and manually refreshed inside Shiba but no changes made to that file will be automatically loaded by Shiba's watcher.However, change that path to a non-hidden/non-dot folder
~/cache/AppName/output.md
and Shiba works beautifully, as normal.Thanks!!