The ability to independently access and modify each individual selection from inside a command or plugin would make TextMate much more powerful and life a lot easier for plugin/bundle developers. Things like 'Expand selection to enclosing HTML/XML tags' or 'Wrap selections in tag (with multiple selections)' would become simple and quick rather than a futile exercise attempting to shoehorn that functionality into the current system.

Just my opinion, thanks for a great text editor and a piece of software I couldn't live without. :) Take care,
Brandon

On 2013-01-29 10:24, Caleb Land wrote:
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.l...@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@lists.macromates.com
http://lists.macromates.com/listinfo/textmate-dev [1]



Links:
------
[1] http://lists.macromates.com/listinfo/textmate-dev

_______________________________________________
textmate-dev mailing list
textmate-dev@lists.macromates.com
http://lists.macromates.com/listinfo/textmate-dev

_______________________________________________
textmate-dev mailing list
textmate-dev@lists.macromates.com
http://lists.macromates.com/listinfo/textmate-dev

Reply via email to