[TxMt] Re: UI blocked while running command with “Output: Discard”
Stefan Daschek
stefan at daschek.net
Sun Aug 7 09:33:06 UTC 2016
Am 07.08.16 um 10:15 schrieb Jacob Carlborg:
>
>> On 06 Aug 2016, at 23:21, Stefan Daschek <stefan at daschek.net>
>> wrote:
>>
>> Interestingly this does not happen with “Output: New Window”: In
>> this case I can continue editing the document even while the
>> command is still running.
>>
>> Is this a bug? Or is there are workaround?
>
> It’s intended behavior. The reason is that the command should not be
> able to run and possibly edit the document simultaneously while the
> user is editing the document.
>
> The solution is to run the command in the background/daemonized. See
> this post for an example [1].
Ah, makes sense! Thanks for the tip, seems to work great:
https://github.com/noniq/RuboCop.tmbundle/commit/a9b789400ccc57892b7bc846a713e72baf5d094f
> My I ask why you’re creating a new RuboCop bundle when this one [2]
> exists?
I tried this bundle but it didn’t work for me. And after looking at its
source I decided that it was way too much effort to bring it up to date:
For example, it tries to run RuboCop directly (that is, via
`Rubocop::CLI.new.run` [1]) from the command’s Ruby process – in my
experience this does not work well with today’s usage of Bundler, Ruby
version managers etc.
I think nowadays TextMate should run Ruby executables like RuboCop or
RSpec [2] like this:
* If a binstub (e.g. `bin/rubocop`) is present, use it.
* Otherwise, if a Gemfile is present and contains an appropriate
entry, run the executable via `bundle exec …`
* Otherwise fall back to simply running the executable, presuming it
is somehow globally installed. (I just realized that I should add
support for `TM_RUBOCOP` at this stage.)
Are there other / better ways of doing this?
[1]: And this no longer works with recent RuboCop versions at all since
the module has been renamed to `RuboCop` about 2 years ago:
https://github.com/bbatsov/rubocop/commit/ff167d8f202baf7a68955db0aaf0dc29afb7e7ee
[2]: I changed the RSpec bundle to work like this already some time ago:
https://github.com/rspec/rspec.tmbundle/commit/a81c3f9c7395d72616ddc82ce5963c113334f7b5
> You might also want to take a look at this pull request that adds a
> RuboCop formatter command to the Ruby bundle [3].
Thanks for the pointer, will look into it! 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?
Stefan.
More information about the textmate
mailing list