Closed michaelgarde closed 7 years ago
It is unrelated because PT keybinding for these keys defines context for text.todo
selector, it means that we can be sure that these keys won’t trigger switch_file
command in PT document; and consider default argument of default keybinding (i.e. those extensions), it is not a conflict at all.
Freeze is a sign of some issue in plain_tasks_open_link
command; it might be some plain error in code or it may happen due to big project, because if open a link with relative path then code has to scan all directories which may include this path, obv. more directories more time it will take, and scanning happens on main thread.
So I mark it as minor bug, because either way we should search a file in separate thread.
If you can provide steps which would reproduce issue regardless of project size, then we shall consider it as a bug. The simplest test is to open tutorial file in empty window (no folder, no other files) and try to open some link — it will either open it in a trice or show message in status-bar that link is absent at the line.
Ah! That is very clever.
Given you suspicion i gave Sublime Text a bit more time to open .\install.txt\ from the Tutorial and after 65 seconds it opened. So you might be correct when suggesting that it is scanning larger amount of directories.
Is the directory search somehow dependent on whether a project is open or not, because i haven't got any active project while testing this.
I did not mean a project per se, but folders in sidebar, plus parents of open files.
From my experience, I’d say that for 65 seconds it would go through dozens of thousands directories, or there might be an issue with your hard drive.
Is there anyway that i can check which directories/files it's scanning through.
In PlainTasks.py insert print after line 581 like this:
for root, _, _ in os.walk(folder):
print(root)
name = os.path.abspath(os.path.join(root, fn))
It will output in console: main menu → View → Show Console.
I added the print(root) as suggested
reloading plugin PlainTasks.PlainTasks
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\icons
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\icons\png
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\messages
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\templates
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\test
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\tests
\\[work network home folder]\[username]\Desktop
\\[work network home folder]\[username]\Desktop\$RECYCLE.BIN
\\[work network home folder]\[username]\Desktop\$RECYCLE.BIN\$RJOMX9D
\\[work network home folder]\[username]\Desktop\[folder on desktop]
\\[work network home folder]\[username]\Desktop\[folder on desktop]
\\[work network home folder]\[username]\Desktop\[folder on desktop]
\\[work network home folder]\[username]\Desktop\[folder on desktop]
C:\Users\[username]\AppData\Roaming\Sublime Text 3\Packages\PlainTasks\messages
But this time opening the file using alt+o was instantaneous, and that was when I realized, that it's searching my desktop, which is automatically synchronized using the Windows Sync Center, while i'm on my work network. But the thing is, now i'm at home and the connection to work is obviously unavailable. So the 65 seconds delay could be due to network latency or something related, although I only have ~50 files on the desktop, including subfolders.
I’ve made some changes in https://github.com/aziz/PlainTasks/tree/347-threading-file-search Could you test it?
If search takes a lot of time you will see quick panel:
Found items will appear while search is running, and if select one then search will be stopped and open the item.
Unfortunately, it feels laggy in ST3 (but much better in ST2), I’m not sure why.
Also, if choose to stop search it may take some considerable time blocking the app (like several seconds), it seems unavoidable.
I’ll merge it to master probably this weekend.
Back at work:
Quick panel works as expected:
and install.txt is showed instantaneous.
The console output looks like this
reloading plugin PlainTasks.PlainTasks
Quick panel unavailable
... 438 more occurrences ...
Quick panel unavailable
1
Screenshot of loading text:
However, total search time is still ~65 seconds.
The "Please wait" in the status bar is really useful. I'd recommend adding something like "searching for install.txt", as it would put it in a better context.
total search time is still ~65 seconds
Well, yes, if you have some speed in network then it is just what you got. What can be done about it? Nothing simple enough, we could cache paths, but it would be too complicated, esp. taking into account that it is not a main feature of PT. You can go offline mode in Sync Centre, but you probably want direct access to shared files while connected. So… I dunno.
The "Please wait" in the status bar is really useful. I'd recommend adding something like "searching for install.txt", as it would put it in a better context.
It was a typo, fixed now https://github.com/aziz/PlainTasks/commit/5bb53b97cbf149f44168ea776d884be77aef0f3b
Given its a network issue, I would also consider this "bug" too small to spend a lot of resources on.
I'm really starting to enjoy this plugin, it's been really useful so far. So thank you very much for you work and dedication. +1:
As a workaround for long searching time you can use absolute path, if absolute path is valid file or folder, then quick panel will show it right away so you won’t need to wait while it find a matching path for relative link.
Noted
After noticing, that Sublime Text freezes when trying the alt+o shortcut in the tutorial, i checked Preferences -> Key bindings and noticed, that there was already setup the following keybinding in Default (Windows).sublime-keymap:
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
I am not sure whether this is the cause of Sublime freezing but it seems related.