<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 22 Aug 2016, at 11:33, Fabian Zeindl wrote:</p>
<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">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.
</div></blockquote></div>
<div style="white-space:normal">
<p dir="auto">Remember also to escape the content before/after the placeholder (caret), incase there is any snippet syntax. The <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">escape.rb</code> under <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">TM_BUNDLE_SUPPORT</code> has an <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">e_sn</code> function for this.</p>
<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">What do I have to set in the macro to get the indentation?
</div></blockquote></div>
<div style="white-space:normal">
<p dir="auto">I assume you want <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">output = insertAsSnippet;</code>.</p>
<p dir="auto"></p></div>
<div style="white-space:pre-wrap"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><div dir="auto">Also: Is it possible to programmatically change the output type in ruby commands, like "exit_discard" and so on?
</div></blockquote></div>
<div style="white-space:normal">
<p dir="auto">Yes, you can use these. Though since that only affects the command, if you <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">exit_discard</code> then you leave the user with a selection, so it might be better to just output an “unchanged” snippet incase you want to abort.</p>
<p dir="auto">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.</p>
</div>
</div>
</body>
</html>