[TxMt] Re: UI blocked while running command with “Output: Discard”

Stefan Daschek stefan at daschek.net
Sun Aug 7 11:29:37 UTC 2016


> One advantage of loading in RuboCop, like the command is doing now,
> is that you don’t need to start an additional process for executing
> the RuboCop command.

Right, but for this to work the command needs to run with the correct
Ruby version (maybe a project specfic one set via RVM and rbenv), and
this version may not be compatible with TextMate’s Ruby API, meaning the
command can’t use all the nice things like `TextMate::Executor`).

Also, for some cases (eg. running rspec in a Rails project using the
Spring preloader) running the executable via a binstub (if present) is
even more performant than requiring it directly in the command.

But I think this discussion belongs into
https://github.com/textmate/bundle-support.tmbundle/issues/20 :-)


> You need this PR [1], where I fixed the issue with `RuboCop` vs
> `Rubocop`, added support for RVM and Bundler. It seems like this
> bundle has been abandoned. But I would rather take over the project
> myself than that someone starts from scratch.

Good point. On the other hand, this other bundle has not been included
in TextMate’s “official” bundle index so far (it can’t be installed from
Preferences → Bundles), so we could also try to freshly create the new
shiny ultimate RubCop bundle ourselves :-)

Right now, my bundle already does all I need in only 50 LOC [1]. Less
code, less bug, less maintenance work. (I decided to use the “clang”
format to show RuboCop output as this plays nicely with the parsing
provided by `TextMate::Executor`, which converts source code locations
to clickable links etc.)

[1]:
https://github.com/noniq/RuboCop.tmbundle/blob/master/Support/lib/rubocop_runner.rb


>> Adding RuboCop to the Ruby bundle could make sense. However, I have
>> one small objection: Running something like RuboCop on every save
>> is quite intrusive, thus it should be something you need to
>> explicitly enable. So the question is: Is it easier for a user
>> wanting to use RuboCop to customize the Ruby bundle, or to install
>> the RuboCop bundle? Not sure about this. Maybe just a question of
>> personal preference after all?
>
> I’m not sure. That PR, for the Ruby bundle, is designed for code
> formatting. That is, running RuboCop with the autocorrect flag. It
> will not open the HTML view showing errors with links back to the
> source code. It just shows the result in a tooltip. But I agree that
>  one should be careful about executing commands on save.

I tend to prefer the solution with a dedicated bundle for running 
RuboCop anyway :) Only problem I’m having with this right now is the 
duplication of the “find and run the right rubycop executable” logic 
between the two bundles. That’s why I suggest a dedicated API for this.


Stefan.


More information about the textmate mailing list