[TxMt] Re: Using Function/Method symbols in Snippets

Allan Odgaard mailinglist at textmate.org
Thu Apr 16 10:06:35 UTC 2009


On 14 Apr 2009, at 17:24, Daniel Royer wrote:

> [...]
> I notice in the status bar at the bottom of the editor window (to the
> right of the Tab Size), there is a "Symbol Popup" menu.  So it seems
> like the information I need is available [...]

It is not, but oft requested. The symbol in the status bar is not  
necessarily the “current function”, it is just the first thing matched  
via some scope selector (optionally passed through some regexps) above  
the caret.

What you can do is make a command that takes stdin as input and then  
do something like: SYMBOL=$(head -n$TM_LINE_NUMBER|grep «function  
prototype regexp»|tail -n1). Have the command “insert as snippet” and  
construct the snippet from the previous.

I am adding an “expose current symbol” to the to-do, since it seems a  
lot want this and don’t care that it might not be 100% correct (and  
whatever hand-roled solution they make is probably even less  
correct ;) ).





More information about the textmate mailing list