Hi.
One functionality that I _always_ wanted to have for snippet-completion, is using snippets on a selected text. So that I have "some text" selected in the editor, then type a hotkey, then type some chars, like e.g. d-i-v and then I get: <div>some text</div> in my editor. Basically one would need an additional parameter (like %selected%) for the snippets.conf, so you'll get something like e.g.: div=<div id="%cursor%">%selected%</div> For normal snippet-completion with tab, %selected% would be treated like %cursor%. When the special hotkey is pressed, every further char must be "eaten" and the resulting string must be checked against a list of snippets and when a snippet is matched it is inserted around the selected text in the editor. I hacked something like that together using the Lua-plugin and it works pretty well and I think it's extremely useful especially for html/xml-editing, so I'm thinking about redoing it in C. The question is: Would something like this be better as a separate plugin or added to standard snippet-completion?
-- Mockey
On Sat, 4 Jul 2009 14:06:12 +0200, Andreas wrote:
Hi.
One functionality that I _always_ wanted to have for snippet-completion, is using snippets on a selected text. So that I have "some text" selected in the editor, then type a hotkey, then type some chars, like e.g. d-i-v and then I get:
<div>some text</div> in my editor. Basically one would need an additional parameter (like %selected%) for the snippets.conf, so you'll get something like e.g.: div=<div id="%cursor%">%selected%</div> For normal snippet-completion with tab, %selected% would be treated like %cursor%. When the special hotkey is pressed, every further char must be "eaten" and the resulting string must be checked against a list of snippets and when a snippet is matched it is inserted around the selected text in the editor. I hacked something like that together using the Lua-plugin and it works pretty well and I think it's extremely useful especially for html/xml-editing, so I'm thinking about redoing it in C. The question is: Would something like this be better as a separate plugin or added to standard snippet-completion?
Depends on how well it integrates into the current code. It's easy to break the snippet completion and the code is already a mess. OTOH assuming your changes won't result in 3000 new lines of code, it's probably not worth putting it into a plugin.
After all: not sure :).
Regards, Enrico
On Sat, 4 Jul 2009 15:39:16 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
Depends on how well it integrates into the current code. It's easy to break the snippet completion and the code is already a mess. OTOH assuming your changes won't result in 3000 new lines of code, it's probably not worth putting it into a plugin.
I'll have a look at the snippet code. Maybe better to try a separate plugin first ...
-- Mockey
Am 04.07.2009 19:04, schrieb Andreas Mokros:
On Sat, 4 Jul 2009 15:39:16 +0200 Enrico Trögerenrico.troeger@uvena.de wrote:
Depends on how well it integrates into the current code. It's easy to break the snippet completion and the code is already a mess. OTOH assuming your changes won't result in 3000 new lines of code, it's probably not worth putting it into a plugin.
I'll have a look at the snippet code. Maybe better to try a separate plugin first ...
-- Mockey _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
The snippet code is, well, limited. I'm still waiting for the python plugin thing, so that we can import the gedit's snippet plugin :)
Best regards.
Hi.
On Sat, 04 Jul 2009 20:20:02 +0200 Thomas Martitiz s0523936@htw-berlin.de wrote:
The snippet code is, well, limited. I'm still waiting for the python plugin thing, so that we can import the gedit's snippet plugin :)
Some questions: Is the gedit snippet plugin so great then? Can it do what I tried to describe (work with selected text)? Gedit doesn't use Scintilla, right?
-- Mockey
On Sat, 4 Jul 2009 21:10:13 +0200 Andreas Mokros am@medienpensionat.com wrote:
Gedit doesn't use Scintilla, right?
At least this can I confirm ;)
Thanks, Frank
On Sat, 4 Jul 2009 21:10:13 +0200, Andreas wrote:
Hey,
I'll have a look at the snippet code. Maybe better to try a separate plugin first ...
Or the other way round, I think it's doesn't really matter if you try to implement it in Geany or as a plugin. Taking the working code and port it into Geany from a plugin or port it from Geany into a plugin shouldn't be that hard at all.
On Sat, 04 Jul 2009 20:20:02 +0200 Thomas Martitiz s0523936@htw-berlin.de wrote:
The snippet code is, well, limited. I'm still waiting for the python plugin thing, so that we can import the gedit's snippet plugin :)
Some questions: Is the gedit snippet plugin so great then? Can it do what I tried to describe (work with selected text)?
No idea. I don't use Gedit :). Additionally, I doubt using the Gedit plugin with a possible future Python interface will work out of the box. And adjusting it might be as much work as implementing it from scratch. But I'm just guessing here, didn't have a look at the Gedit thing at all.
Gedit doesn't use Scintilla, right?
Nope. They use gtksourceview.
Regards, Enrico
On Sun, 5 Jul 2009 17:01:13 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
Or the other way round, I think it's doesn't really matter if you try to implement it in Geany or as a plugin. Taking the working code and port it into Geany from a plugin or port it from Geany into a plugin shouldn't be that hard at all.
I think I might start with a plugin, when I find some time. I have some ideas for added functionalities already. But I might bother you with some more questions here then ...:-)
Is the gedit snippet plugin so great then? Can it do what I tried to describe (work with selected text)?
No idea. I don't use Gedit :).
I played around a bit with it (didn't know that the snippet-plugin is actually included in the standard gedit-install). So, yes: It has some interesting snippet-functionalities. But it also showed some pretty weird behaviours (either bugs or I just didn't use it correctly) ...
Additionally, I doubt using the Gedit plugin with a possible future Python interface will work out of the box.
I also doubt that. The different editor-control for one should make quite a difference.
-- Mockey
On Sun, 5 Jul 2009 18:07:53 +0200, Andreas wrote:
On Sun, 5 Jul 2009 17:01:13 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
Or the other way round, I think it's doesn't really matter if you try to implement it in Geany or as a plugin. Taking the working code and port it into Geany from a plugin or port it from Geany into a plugin shouldn't be that hard at all.
I think I might start with a plugin, when I find some time. I have some ideas for added functionalities already. But I might bother you with some more questions here then ...:-)
That's one of the reasons why this list exists :).
Additionally, I doubt using the Gedit plugin with a possible future Python interface will work out of the box.
I also doubt that. The different editor-control for one should make quite a difference.
Exactly. Though probably parts of the concept of the plugin can be transferred.
Regards, Enrico