[txmt-dev] Re: Question about PlugIns

Caleb Land caleb.land at gmail.com
Tue Jan 29 17:24:01 UTC 2013


I spent some time playing with making a regular bundle, and I think that I can make some of the functionality work.  

The current (textmate 1) plugin has some functionality that I don't think I will be able to implement, like selecting matching tags. AFAIK there isn't a way to update the selection from a bundle command.

Part of the problem is that Emmet is written in javascript, so I have to bundle Node in my bundle for it to work.  

I realize things are still in flux, so a bundle command that gets me the most useful features of emmet will work fine, but a more official plugin API would be cool.

I'd try to come up with something, but I'm still learning how TextMate2 works.

I'll see where this bundle solution works.

-Caleb


On Monday, January 28, 2013 at 3:24 PM, Allan Odgaard wrote:

> On Jan 28, 2013, at 8:41 PM, Caleb Land <caleb.land at gmail.com (mailto:caleb.land at gmail.com)> wrote:
>  
> > […] I can type "table>tr*3>td*3" and hit ^E and it will create a table with three rows and three columns.
> >  
> > It works on selections or if the cursor is at the end of the Emmet expression.
> >  
> > How it works
> > From what I can tell, when an Emmet expand action is executed, it looks at the carret position/selection and determines if the selection contains a valid expansion expression (or if the text proceeding the carret is a valid expression if there is no selection).
> >  
> > When the plugin is ready to perform the expansion, it tells TM to select the contents of the expansion expression, and calls `insertSnippetWithOptions` to replace the contents it with the expanded contents.
>  
> It sounds like this could be done as a regular bundle command:
>  
> Input: Selection or Line¹
> Output: Replace Input, Format: Snippet
>  
> Am I missing something?
>  
>  
> ¹ Presently this fallback input is not exposed in TM2’s bundle editor. You need to edit the XML of the tmCommand and insert:
>  
> <key>fallbackInput</key>
> <string>line</string>
>  
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com (mailto:textmate-dev at lists.macromates.com)
> http://lists.macromates.com/listinfo/textmate-dev
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20130129/f62b47bc/attachment.html>


More information about the textmate-dev mailing list