[TxMt] Re: "Document.did-change" and access to the current document in a bundle?

Graham Heath graham.p.heath at gmail.com
Thu Sep 29 17:32:00 UTC 2016


This is huge!

Thanks so much for this! I’ll be hopefully carving out a big chunk for this
work this weekend!

I’ll be sure to keep you updated.

Thanks again,

Graham Heath


On September 28, 2016 at 11:42:25 AM, Allan Odgaard (
mailinglist at textmate.org) wrote:

A few “typos” made it into my email.

The values should have been onDocumentChange and onDocumentSave rather than
documentDidChange and documentDidSave. The latter though is what they’ll
likely be changed to.

And the environment variable present for successive runs is TM_REFRESH.

Here’s an example which works with the current nightly build:
https://github.com/textmate/markdown.tmbundle/blob/live-preview/Commands/Markdown%20preview.plist

On 28 Sep 2016, at 16:59, Allan Odgaard wrote:

On 24 Aug 2016, at 18:26, Graham Heath wrote:

Current test build has a preliminary implementation of this feature.

Thats great news. You mention that the commands could update the HTML view,
would they also have access to the gutter (and/or tooltips)?

You can access gutter via $TM_MATE and tool tips can be shown by using
$DIALOG.

You’ve got a good point that the process should be killed when a user no
longer wants it, for my use though I can’t imagine wanting to turn the
linter service off while TextMate was still open. If there was a
"application-will-close" event, bundles could be responsible for cleaning
up after themselves.

Here is the preliminary documentation (I will likely change the keys to
match the semantic classes and also make it a mask rather than either/or):
------------------------------

New autoRefresh key that can be set in tmCommand, value can be either:

   - documentDidChange: Re-run the command after document has changed.
   - documentDidSave: Re-run the command after a file in the project has
   been saved (after delay to coalesce multiple documents being saved).

If a document has autoRefresh set to onDocumentChange it will stop running
if the document is closed. If there is a HTML output window, this window
will then also close.

If a command has HTML output, closing the HTML output will stop running the
command.

If the user runs a command with autoRefresh enabled for a second time, and
there is an open HTML output window associated with the command, then it
brings the window to front, otherwise it will stop the first instance.

For successive command executions the TM_REFREH environment variable is
present and set to YES.

Planned: If the command’s title matches: (\w+) / (\w+) (.+) then it will
show as $1 $3 by default and $2 $3 when running. This means the command can
be named “Show / Hide Preview” and will appear as “Show Preview” unless the
preview is already showing, in which case it becomes “Hide Preview”.

Debouncing an event like this over 300ms would mean that the event doesn’t
fire until 300ms have elapsed where the trigger wasn’t re-triggered.

Such complicated terms for “when the user is idle” :)

_______________________________________________
textmate mailing list
textmate at lists.macromates.com

http://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
textmate at lists.macromates.com
http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160929/7e0f7f90/attachment-0001.html>


More information about the textmate mailing list