SublimeLinter-contrib-xo
SublimeLinter-contrib-xo copied to clipboard
Run fix in some sort of background thread?
I've tried enabling the fix_on_save flag today, which is really great, but it massively slows down the editing experience. Sublime locks for somewhere between 1-2 seconds while it processes this.
Is there anyway that this can be ran in some sort of background thread so Sublime remains responsive through this duration?
I think https://github.com/xojs/SublimeLinter-contrib-xo/blob/92aa8b3e0d8ac021ce4d34cd7fa9b0cc758b9ed6/linter.py#L172 could use on_pre_save_async instead. But I haven't tested.
https://www.sublimetext.com/docs/3/api_reference.html
// @LuKks
@sindresorhus looks promising! I'm happy to give it a test on my project if someone can publish some sort of pre-release
@sindresorhus is there a way I can try this out? I've tried modifying the linter.py file inside /home/.config/sublime-text-3/installed packages/SublimeLinter-contrib-xo.sublime-package. Is that the correct way to try and test? At the moment doesn't look like it's working
Ok, confirmed that the change has been made with some logging, unfortunately it doesn't seem to fix the locking issue :( . Been trying to compare to the prettier plugin which does similar stuff but don't yet understand python well enough to spot the difference.
I tried just changing to on_pre_save_async but works the same (sync), I think we need some code related to threading in Python to make it really async, for example running xo_fix function in another thread.
Hi @IPWright83, did you find any solution to this issue?
@rocktimsaikia I didn't. Though I've moved company and we just use eslint. It doesn't seem to have the same problems as the xo linter. Save in build seems to work fine without blocking.