Hi,
I have to write much XSL stuff. I use among others the snippet collection of Andreas Schöller (BTW thanks for that). He was so kind to add information about the valid values of parameters.
example: Snippet ou => <xsl:output name="" encoding="utf-8|ASCII|US-ASCII|iso-8859-1|utf8|KOI8R|cp1251" indent="no|yes" use-character-maps="mapping1 mapping2" method="text|html|xml|xhtml" />
As usual I can use TAB to jump to each ${n:} token. Now my question: Would it be possible to convert e.g. the token 'text|html|xml|xhtml' into a pull-down menu?
I tried it this way: After pressing TAB TM highlights 'text|html|xml|xhtml'; I invoke a command:
`echo -en "$TM_SELECTED_TEXT" | ruby -e ' require File.join(ENV["TM_SUPPORT_PATH"], "lib/dialog.rb") words = STDIN.read().split("|") print words[(Dialog.menu words)] '`
and I can choose what I want. After that, of course, I cannot use TAB to navigate through the snippet any more, unfortunately.
I also tried a snippet like:
<xsl:output method="${1:`echo -en "text|html|xml|xhtml" | ruby -e ' require File.join(ENV["TM_SUPPORT_PATH"], "lib/dialog.rb") words = STDIN.read().split("|") print words[(Dialog.menu words)] '`}" encoding="${2:`echo -en "utf-8|ASCII|US-ASCII|iso-8859-1|utf8| KOI8R|cp1251" | ruby -e ' require File.join(ENV["TM_SUPPORT_PATH"], "lib/dialog.rb") words = STDIN.read().split("|") print words[(Dialog.menu words)] '`}"/>
In principal this works and the TAB behaviour isn't disturb but I have no visual feedback what I'm typing while the menus popping up and the TAB mechanism starts at token 1 which I already entered.
Would it cost much effort to implement such a behaviour? Meaning if I press TAB and within the new selection occurs a given delimiter (here | ) or tag or what ever that the snippet parser will show this selection as pull-down menu automatically without distroying the TAB mechanism. And, would it make sense as a global snippet feature?
Regards,
Hans
On 28. Apr 2007, at 00:54, Hans-Jörg Bibiko wrote:
[...] As usual I can use TAB to jump to each ${n:} token. Now my question: Would it be possible to convert e.g. the token 'text|html|xml| xhtml' into a pull-down menu?
Yes, and I gather you figured from the next paragraph of your letter.
I tried it this way: [...] and I can choose what I want. After that, of course, I cannot use TAB to navigate through the snippet any more, unfortunately.
Is this because you have set the commands output to “Insert as Snippet”?
If the command has input selection and output replace selection, it does not break the snippet tab chain.
I also tried a snippet like: [...] In principal this works and the TAB behaviour isn't disturb but I have no visual feedback what I'm typing while the menus popping up and the TAB mechanism starts at token 1 which I already entered.
Yeah, presenting the menu at insertion time is not going to work gracefully.
Would it cost much effort to implement such a behaviour? [...]
You mean make native snippet syntax for pop-ups? If you search the list, this has come up more than once in the past, and will be supported in 2.0 :)
On 28.04.2007, at 19:47, Allan Odgaard wrote:
On 28. Apr 2007, at 00:54, Hans-Jörg Bibiko wrote:
[...] As usual I can use TAB to jump to each ${n:} token. Now my question: Would it be possible to convert e.g. the token 'text|html|xml| xhtml' into a pull-down menu? [...] Would it cost much effort to implement such a behaviour? [...]
You mean make native snippet syntax for pop-ups? If you search the list, this has come up more than once in the past, and will be supported in 2.0 :)
Thanks a lot :)
Cheers,
Hans