[TxMt] Re: Code folding questions

Fabian Zeindl fabian.zeindl at gmail.com
Mon Aug 22 10:50:06 UTC 2016


> On 22.08.2016, at 11:39 , Allan Odgaard <mailinglist at textmate.org <mailto:mailinglist at textmate.org>> wrote:
> 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
> 
> 

That is the weird thing: My command (running from the Macro):

#!/usr/bin/env ruby18 -wKU			 
						 
require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb"
					
block = STDIN.read			
					
if block =~ /^\{ [^\s]/			
    print e_sn("{\n#{block[2..-3]}\n}") 
else					
    print e_sn(block)			
end					


1. When I replace selected Text, or use "snippet" I get no indentation:

function() {			
    const x = {	number: 33 } 	
}				

-> 

function() {	
    const x = {	
number: 33	
}    		
}		

2. When I output with insertAsSnippet, I get almost correction indentation 

function() {			
    const x = {	number: 33 } 	
}				

-> 

function() {	
    const x = {	
    number: 33	
    }    	
}		

3. When I output with insertAsSnippet, but just print the block again without changes, I get more indentation than I need…

function() {	
    const x = {	
    number: 33	
    }		
}		

->

function() {		
    const x = {		
            number: 33	
        }		
}			



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160822/180605dd/attachment.html>


More information about the textmate mailing list