aziz / PlainTasks

An opinionated todo-list plugin for Sublime Text editor (version 2 and 3)
MIT License
3.29k stars 286 forks source link

Open file triggers searching in the whole project #386

Open chaonan99 opened 6 years ago

chaonan99 commented 6 years ago

Thanks for the nice plugin! But as my project is huge (containing some dataset folder), when I try to open file link with ctrl+o, it starts searching the entire project tree and cause sublime to crash. How can I restrict the search just relative to the current open file?

vovkkk commented 6 years ago

You can only use a full path in a link to avoid waiting a long search.

But crash? how many folders and files you have?

chaonan99 commented 6 years ago

Thanks! What I mean by crash is that when I "stop search" after searching has started for some time, sublime is frozen and I have to do a force quit. I cannot get a precise number in a short time. For more reference, I'm using sshfs and let it follow symlinks, which is known to be not working well with sublime. I'm not sure if that causes the problem.

vovkkk commented 6 years ago

I cannot get a precise number in a short time

I’d really like to know tho.

when I "stop search" after searching has started for some time, sublime is frozen and I have to do a force quit

When you press Stop search, the code joins a thread, in which search happen, to the main one; so it is blocking operations. Taking into account that we’re talking about network here, did you try to wait instead of force quite? 10 seconds? 30 seconds? a minute?

Do you absolutely need to use sshfs? They say that unison & unox workaround most issues of ssh.

chaonan99 commented 5 years ago

That's 335804 files

vovkkk commented 5 years ago

All in one directory? well, as I said stopping search have to join a thread which is blocking operation, so if it takes too long to finish one iteration (we go though one directory per an iteration) then it will block main thread until it has a chance to exit the function: https://github.com/aziz/PlainTasks/blob/master/PlainTasks.py#L594

The reason for joining is to make sure that sequent searches will work as expected, i.e. a new search must not be started unless a previous is finished or cancelled, so results won’t be messed up in any way. I think we can avoid joining, but since we’ll have simultaneously-running threads it will be less reliable and more complicated. I don’t know when I’ll have a chance to try implementing this.

chaonan99 commented 5 years ago

Can this be implemented as a relative path to the current file, or add a configuration file to choose between searching or not? I guess traversal of a large directory will be expensive any way.