[TxMt] Re: Code folding questions

Allan Odgaard mailinglist at textmate.org
Mon Aug 22 09:39:56 UTC 2016


On 22 Aug 2016, at 11:33, Fabian Zeindl wrote:

> Right now I'm outputting a snippet, since I need proper indentation 
> and as far as I know that's only possible with a snippet? I'll set the 
> cursor with $0 then.

Remember also to escape the content before/after the placeholder 
(caret), incase there is any snippet syntax. The `escape.rb` under 
`TM_BUNDLE_SUPPORT` has an `e_sn` function for this.

> What do I have to set in the macro to get the indentation?

I assume you want `output = insertAsSnippet;`.

> Also: Is it possible to programmatically change the output type in 
> ruby commands, like "exit_discard" and so on?

Yes, you can use these. Though since that only affects the command, if 
you `exit_discard` then you leave the user with a selection, so it might 
be better to just output an “unchanged” snippet incase you want to 
abort.

TextMate detects when a command’s output matches what’s already in 
the document (it does prefix/suffix match) so there should be no visible 
flash when replacing content with what’s already there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160822/c07f417a/attachment.html>


More information about the textmate mailing list