-
Notifications
You must be signed in to change notification settings - Fork 15
Run rustc/cargo in the background to avoid blocking UI #17
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
Conversation
This seems like a good idea, but I wonder if the correct fix is to take advantage of the threaded queue already in SublimeLinter. |
I had no idea there was one :) |
+1 @oschwald Do you think doing this _the right way_™ would be complicated ? If not I could possibly give it a try, even though I have absolutely no experience with SublimeText- or Linter-Plugins. |
I'd also like to see this implemented. I think the threaded queue should be used automatically for the continuous linting, but the plugin currently doesn't work with continuous linting. If I recall correctly, the reason for this has to do with the fact that, with Cargo, it needs the full build directory rather than being able to copy the file to a temp directory. I suspect getting the other modes working with the queue wouldn't be that hard, but it would likely involve using some less documented parts of SublimeLinter. |
I see - from what you say ThreadQueues in SublimeLinter are tried to continuous linting, which doesn't work for cargo unless the active buffer is flushed to disk all the time. This seems like an architectural oversight in SublimeLinter, if the orthogonal concepts of continuous linting and background-operation through ThreadQueues have truly been tied to each other. In an ideal world, one would just start a new background invocation of cargo + linting each time a file managed by cargo (or more generally, any *.rs file in the project) is saved. Maybe it's possible to piggy-back the continuous linting + threadqueues features just to get a callback, and check against the last time the buffer was saved. That way, the cargo invocation could happen as part of the continous linting framework, even though it will only be executed every once in a while, and operates on files already saved to disk. |
That might be possible. It would probably involve using undocumented calls to SublimeLinter, but this plugin already does that anyway. It might be worth engaging with the SublimeLinter maintainers on how to best do this. |
Sorry to intrude, but are there any updates on this? |
It'd be great to see this implemented using the API available in SublimeLinter itself. I am bit concerned that this particular PR will introduce problems for some users, but if a number of people have been using it without issue, I'd consider merging it as is. |
This PR would also benefit from the upcoming wait-mode to prevent multiple cargo processes to interfere with each other. |
Would it be of any benefit to use |
Sounds like a great idea - I believe it's the same that the |
Yep, that's actually what made me look into this. I think Without actually spending more than a minute reading this repo, I think all it would take is to edit this line. |
Although it is a bit off-topic to this PR, I did switch to using |
Otherwise the whole editor locks up for 10+ seconds when using cargo.
Sharing the settings between threads is not safe but I got bored halfway through pulling out all that shared state :) It would be difficult to actually break it anyway - the settings would have to change in the middle of
really_run
.