Zen Coding in HippoEDIT (> 1.50.770)

Started by alex, May 30, 2012, 05:21:38 AM

Previous topic - Next topic

alex

Recently I had a time to check what is possible with Zen Coding integration in HippoEDIT and end up with more a less complete implementation.
What is supported:
- all Zen Coding commands
[attach=1]
- Zen Coding sesstings can be found in Tools->Options->Plugins->Zen Coding
[attach=2]
- Zen Coding abbreviations and snippets are now reigstered as script templates and suggested in Code Hints and also shown in Code Compleation list (if enabled to show Code Templates there)
[attach=3]
[attach=4]

Assigning of the shortcuts to Zen Coding commands goes in standard way: Tools->Options->Keyboard Settings and filter by "ZenCoding".
In the package attached (zen_coding.zip) three main files, which control wrap Zen Coding for HippoEDIT:
- zen_editor.js : main helper object with HippoEDIT related edit functionality used by Zen Coding
- zen_file.js : file related functionality (needed for some commands as "Update Image Size" )
- zen_main.hejs : HippoEDIT plugin file, that does all UI stuff and register handlers (menu creation, commands creation, code template registration etc)
- directory /core contains Zen Coding code, which can be easy updated with newest version from Zen Coding web site, if needed (contains original files from here).

To install plugin, just unpack it somewhere and call zen_main.hejs, by Execute... from Tools or by opening it and Execute zen_main.hejs.
To uninstall -> Tools->Options->Plugins-> and uncheck zen_main.hejs

For more information go to Zen Coding site:
http://code.google.com/p/zen-coding/

For details about integration, you can ask here.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

This is very nice, thank you Alex. Also a question: is that possible to also have the Zen Coding working for database related files, e.g. SQL?
For example, I would like not to type SELECT * FROM all the time, but rather have S* typed that would rather expand into the former.

alex

Hi Arthur,

it was possible with templates already from first versions of HE ;)
Just go to Tools->Options->Syntax Settings->T-SQL->Code Templates and add new template with key S* and SELECT * FROM TABLE as template text.

And Zen Coding is not from me actually (see references in the post),  but from one Russian guy who has done it for HTML/CSS syntaxes. I did just a wrapper around his engine, which is rather popular in HTML related areas. You can ask the the guy directly if he can add SQL support, than it will be available in HE automatically.

BR, Alex
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

I have just tried the "Tools->Options->Syntax Settings->T-SQL->Code Templates and add new template with key S* and SELECT * FROM TABLE". Does not work, restarted HE, it does not either.

JJK

Hi Arthur
Here it works. Can you see the shortcut S* in the shortcuts list of SQL code template ?
If not, you have to recreate it.
If yes, you expand it by Enter key by default.

alex

Should work without restart.
If not, and yo do not see it in the list, as JJK wrote, you have not created it :)
Dont forget to press save/apply in Options dialog.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Thank you, I feel dumb guys  ;)
I cannot put S* into the shortcut, I could e.g. Shift+Num*
It simply does not work for me.
The screenshot shows what I got [attach=1].
And by the way, several other shortcuts do work e.g. the commenting.
I am also seeing that a comment supposed to surround the selected text, and that is not happening.
The result I get is /*  */TEST not /* TEST */
Besides, HE crashed after 5 min (crash report sent, btw, I did not bother removing the pdb file, so all should be intact).

alex

:) What I can tell Arthur... :)
By me works :) Everything.

From screenshot looks like you have defined template right.
1) Create new T-SQL document
2) Type s*  . Do you see tooltip suggesting you S* ? If you press them Enter/Tab while tooltip is visible is it expanded?
3) If you type s* and directly after it press Ctrl+Enter is it is expanded? "s*" is a template key.
4) If you just press Shift+Num* is SELECT * FROM inserted in current position?
5) How you have tried to surround text by comments? You should assign another shortcut to it (fex Ctrl+Shift+Num*), save, select some text in t-sql document, call shortcut (Ctrl+Shift+Num*), text should be surrounded. If you just call it without selected text or in some other way does not work. Also works with Surround with Template feature (Ctrl+Space after selection).
6) Thanks for the crash report, but would be nice to see some words from such experienced user like you about how this can be reproducible, while you got it min 2 times ;)

[attachimg=1]

BR, Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

I tried to repro this. At this stage this works on my home laptop  :). I mean it expands the s* (steps 1-4).
But I still do not get how to surround the selection with comments. And Ctrl-Space does not work either.
Also, this: /* %SelectedText%%|% */ supposed to interact with the keyboard, right? 

alex

to surround selection with comment you can use:
- standard functionality. Select text and press comment button on toolbar or call comment command.
- or use automatic templates. In this case, you still need to select text to comment before, and then:
  -> call Format->Surround by template or
  -> assign shortcut to T-SQL template with key /* and press applying to selection or
  -> after selecting text, press Ctrl+Space, and you see template menu

Of course this all correct if you have not remapped shortcuts (Ctrl+Space) and do not have persistent selection mode active (Edit->Selection->Lock is off).
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Strange, but now all works. This is after I rebooted my machine.
And thank you for the timely feed back!