Author Topic: Zen Coding in HippoEDIT (> 1.50.770)  (Read 3567 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2170
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Zen Coding in HippoEDIT (> 1.50.770)
« on: May 30, 2012, 04:21:38 am »
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
ila_rendered
- Zen Coding sesstings can be found in Tools->Options->Plugins->Zen Coding
ila_rendered
- 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)
ila_rendered
ila_rendered

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.
« Last Edit: June 05, 2012, 01:29:38 am by alex »

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #1 on: June 25, 2012, 01:43:14 am »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2170
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #2 on: June 25, 2012, 12:18:57 pm »
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

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #3 on: June 26, 2012, 06:45:55 pm »
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.

Offline JJK

  • Registered User
  • Full Member
  • *
  • Posts: 152
  • Karma: +2/-0
    • View Profile
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #4 on: June 26, 2012, 08:35:42 pm »
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.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2170
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #5 on: June 26, 2012, 09:04:48 pm »
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.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #6 on: June 26, 2012, 10:06:47 pm »
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 ila_rendered.
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).

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2170
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #7 on: June 27, 2012, 03:06:57 am »
:) 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 ;)



BR, Alex.

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #8 on: June 27, 2012, 04:56:17 am »
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? 

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2170
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #9 on: June 28, 2012, 08:44:42 pm »
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).

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Zen Coding in HippoEDIT (> 1.50.770)
« Reply #10 on: June 28, 2012, 11:02:10 pm »
Strange, but now all works. This is after I rebooted my machine.
And thank you for the timely feed back!