Xemmet: Emmet for Komodo X

Today I released the first alpha version of Xemmet. Xemmet is a wrapper for a very popular toolkit called Emmet. As you may know, there’s already an Emmet for Komodo, but it uses old Emmet core and legacy API, which makes customizing it very hard.

As for me, I didn’t use a lot of Emmet functionality at all. I has been using Expand Abbreviation a lot and that’s the only feature in Xemmet for now. I’m working on Wrap with Abbreviation feature which I find useful.

You can grab and build it yourself here: https://github.com/Defman21/Xemmet

Why Xemmet?

  • It uses Tab for auto-completion.
  • It’s built on Komodo SDK.
  • It’s easy to extend.
  • It’s created by me :stuck_out_tongue: (it means you can get support for it)
  • It does not conflict with your Toolbox (assuming you’re using Tab key for auto-abbreviations)

Why not Xemmet?

  • It does not have all the features that original Emmet has.
  • They won’t be implemented
  • It’s an advanced add-on and requires some knowledge of Komodo add-ons development to customize it
  • It’s in alpha and unstable
  • It works only with Komodo X (Emmet works in 9 and X)

Nice! Aren’t you gonna PR this to the Packages repo? :slight_smile:

Nope. Once I’ll fix HTML beautify/indentation - I send you a PR :slight_smile:

It’s in alpha version, not something I want to push to Packages.

Alright fair enough :slight_smile:

Note since you are using Tab you’ll want to ensure that you aren’t breaking auto-abbreviations. Ie. handle the keystroke event if you can, but if you cannot then just let it pass.

Yeah there are some issues with auto-abbreviations and auto-completions. I’ll try to fix them but no promises for that. If I won’t able to fix them I’ll ask user to update their setting so \t won’t issue auto-completions for auto-abbreviations and auto-completions.

Please check with me if you can’t figure it out. I’d be hesitant to accept a PR for an addon that “breaks” core functionality.

Now, everything works fine. I added a preference for it. There will be a UI checkbox for it, but not now :slight_smile:

If xemmet_snippets_are_important is true, then Xemmet will check your toolbox for a snippet that called the same as the abbreviation you want to expand, and, if it will find this snippet (and it’s an abbreviation, not just a snippet), then it will expand it instead of expanding an Emmet abbreviation. This is disabled by default.

To enable it for now, open Console and run this:

require('xemmet').prefs.setBool("xemmet_snippets_are_important", true). No need to restart Komodo or Xemmet.

Note

If your Emmet abbreviation is invalid (for example ~ is invalid abbreviation), then Xemmet will check if this is a custom Xemmet snippet, if not, then just pass your string to Komodo handlers, so if there’s an abbreviation called “~” - Komodo will expand it; if yes, then it will try to expand it, but if it contains some errors, then Xemmet pass it to Komodo.

Note 2:

xemmet_snippets_are_important means that Komodo snippets has the biggest priority for Xemmet.

If this setting is enabled, Xemmet will parse your string in this order:

  1. Check if Komodo snippet, if yes - pass to Komodo to expand it, if not - next step
  2. Check if Xemmet snippet, if yes - expand, if an error occurred - pass it to Komodo, if not - next step
  3. Try to expand abbreviation, if successful - insert it, if not - pass to Komodo.

If this setting is disabled, Xemmet will parse your string in this order:

  1. Check if Xemmet snippet, if yes - expand, if an error occurred - pass it to Komodo, if not - next step
  2. Try to expand abbreviation, if successful - insert it, if not - next step
  3. Check if Komodo snippet, if yes - pass to Komodo to expand it, if not - do nothing.

Added Wrap Selection with Abbreviation (HTML only). As you requested, @babobski! :slight_smile:

Added a pre-release for those who want to test it right now. The first release will be when I finish the Preferences UI for it.

Been using the old broken plugin and bugging people to make me a new one since I’m lazy / have no time. So will be using this from today and not have to use a workaround to expand :smiley:. Expand is the only thing I have ever used, didn’t even know other things existed until I had to look into the old plugin.

2 Likes

This is awesome. Long time ago I asked Emmet dev on Twitter will he update he’s plugin, he said he have no time. :worried:

1 Like

In Xemmet 0.6.1, a new feature has been implemented. Now you can select an abbreviation and expand it. Note this won’t work with tabstops.

I’m looking for a good solution to implement expanding inline abbreviations (like Some text ul>li{hello world}| some other text)

I’m looking for some beta testers :stuck_out_tongue:

https://github.com/Defman21/Xemmet/releases/tag/0.7.0-b grab this release and try to use inline expand. I need some use-cases to be tested. It should work fine in most cases.

Inline expand is a feature allows you to press Tab to expand a valid Emmet abbreviation before your caret. It works in Wrap Selection as well.

Also, please take part in solving this issue: https://github.com/Defman21/Xemmet/issues/9

Note there’s a bug which makes you press Esc after each time you’ve expanded an abbreviation.

I can’t install Xemmet Please How to install it Manual?

What kind of issues do you have when installing Xemmet? You can download the xpi from here and drap’n’drop it onto Komodo window.