Hi All,
There are problems with the default snippets applying to all documents. It is not possible to add <snippet><tab> in a document even though the snippet is irrelevant to that filetype.
A recent conversation on the ML showed problems with the Haskell do snippet and shortly after I hit the problem adding "if<tab>" in a text document (Murphy I guess).
Basically having language specific snippets in the default section is just wrong.
The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing.
I'll collate suggestions, patches etc then commit.
Cheers Lex
G'day Lex,
[...] The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing. [...]
The current defaults also apply to PHP, JavaScript (and thus also Actionscript I'd guess), C#, Vala... basically if its syntax is based on C then those snippets should apply.
On Thu, Nov 24, 2011 at 2:17 PM, Ross McKay rosko@zeta.org.au wrote:
G'day Lex,
[...] The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing. [...]
The current defaults also apply to PHP, JavaScript (and thus also Actionscript I'd guess), C#, Vala... basically if its syntax is based on C then those snippets should apply.
G'day Ross, added.
Cheers Lex
-- Ross McKay, Toronto, NSW Australia "Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Lex Trotman wrote:
On Thu, Nov 24, 2011 at 2:17 PM, Ross McKay rosko@zeta.org.au wrote:
G'day Lex,
[...] The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing. [...]
The current defaults also apply to PHP, JavaScript (and thus also Actionscript I'd guess), C#, Vala... basically if its syntax is based on C then those snippets should apply.
G'day Ross, added.
Looking forward to seeing that patch applied so I can pull and rebuild :-).
Cheers, Erik
Lex Trotman wrote:
On Thu, Nov 24, 2011 at 2:17 PM, Ross McKay rosko@zeta.org.au wrote:
G'day Lex,
[...] The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing. [...]
The current defaults also apply to PHP, JavaScript (and thus also Actionscript I'd guess), C#, Vala... basically if its syntax is based on C then those snippets should apply.
G'day Ross, added.
Lex, has this hit the repo yet? I've just updated to the git head version and I'm still having trouble with do<tab> in Haskell.
Cheers, Erik
On 11/30/2011 06:33 PM, Erik de Castro Lopo wrote:
Lex Trotman wrote:
On Thu, Nov 24, 2011 at 2:17 PM, Ross McKayrosko@zeta.org.au wrote:
G'day Lex,
[...] The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing. [...]
The current defaults also apply to PHP, JavaScript (and thus also Actionscript I'd guess), C#, Vala... basically if its syntax is based on C then those snippets should apply.
G'day Ross, added.
Lex, has this hit the repo yet? I've just updated to the git head version and I'm still having trouble with do<tab> in Haskell.
I don't use any Haskell so I'm not really sure, but I did notice a comment/section in snippets.conf (default):
[Haskell] # prevent completion of "do"-while-loops in Haskell do=
I guess that's overriding the `do` snippet for Haskell so that it doesn't insert anything?
Cheers, Matthew Brush
[...]
Lex, has this hit the repo yet? I've just updated to the git head version and I'm still having trouble with do<tab> in Haskell.
No, real life has been in the way, I guess since not many people commented no one cares so it can be committed soon.
I don't use any Haskell so I'm not really sure, but I did notice a comment/section in snippets.conf (default):
[Haskell] # prevent completion of "do"-while-loops in Haskell do=
I guess that's overriding the `do` snippet for Haskell so that it doesn't insert anything?
Yes, Haskell do syntax is different, do goes roughly where the : goes on a Python loop and the rest is indented like Python, so the default snippets are way wrong and inserting nothing is the best compromise until the defaults are moved.
Cheers Lex
Cheers, Matthew Brush
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Lex Trotman wrote:
Yes, Haskell do syntax is different,
Yes, agreed.
do goes roughly where the : goes on a Python loop
Actually there are a number of syntactically valid ways to layout a do. Here are two:
functionName param = do x <- whatever
functionName param = do x <- whatever
Its the second one (and trying to place a <tab> after the 'do') which is causing the problems.
and the rest is indented like Python,
Well lets just say Haskell used significant leading whitespace, like Python.
Cheers, Erik
Hey Lex -- and sorry for the delay.
Le 24/11/2011 03:36, Lex Trotman a écrit :
Hi All,
There are problems with the default snippets applying to all documents. It is not possible to add <snippet><tab> in a document even though the snippet is irrelevant to that filetype.
A recent conversation on the ML showed problems with the Haskell do snippet and shortly after I hit the problem adding "if<tab>" in a text document (Murphy I guess).
Basically having language specific snippets in the default section is just wrong.
Agreed.
The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing.
First thing when I look at the file: it looks terribly repetitive! Maybe something in the style of filetype's sections copying ([name=othername]) would help having all this clearer, ending up with something like
[C] if=... else=...
[C++=C] try=...
[Java=C++] [PHP=C++] [C#=C++] [Javascript=C++] ...
[Python] if=... else=...
[HTML] table=...
Needs to be implemented, but a first though make me think it'd make easier to have/configure per-filetype snippets.
What do you think?
I'll collate suggestions, patches etc then commit.
Why keep an empty [Haskell] section?
Cheers, Colomban
On 12/03/2011 04:10 PM, Colomban Wendling wrote:
Hey Lex -- and sorry for the delay.
Le 24/11/2011 03:36, Lex Trotman a écrit :
Hi All,
There are problems with the default snippets applying to all documents. It is not possible to add<snippet><tab> in a document even though the snippet is irrelevant to that filetype.
A recent conversation on the ML showed problems with the Haskell do snippet and shortly after I hit the problem adding "if<tab>" in a text document (Murphy I guess).
Basically having language specific snippets in the default section is just wrong.
Agreed.
The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing.
First thing when I look at the file: it looks terribly repetitive! Maybe something in the style of filetype's sections copying ([name=othername]) would help having all this clearer, ending up with something like
I had started working on filetype-specific snippets here: https://github.com/codebrainz/geany/commit/9a635da79ecd9465c856ce9d02dd95c14...
This would let a `[snippets]` section be in the filetypes.* files and I think would support group copying like the `[styles]` section does.
It still needs some work, but it's a start.
Cheers, Matthew Brush
Matthew Brush wrote:
First thing when I look at the file: it looks terribly repetitive! Maybe something in the style of filetype's sections copying ([name=othername]) would help having all this clearer, ending up with something like
I had started working on filetype-specific snippets here: https://github.com/codebrainz/geany/commit/9a635da79ecd9465c856ce9d02dd95c14...
This would let a `[snippets]` section be in the filetypes.* files and I think would support group copying like the `[styles]` section does.
It still needs some work, but it's a start.
Oh yes please!
Erik
Le 04/12/2011 01:53, Matthew Brush a écrit :
On 12/03/2011 04:10 PM, Colomban Wendling wrote:
Hey Lex -- and sorry for the delay.
Le 24/11/2011 03:36, Lex Trotman a écrit :
Hi All,
There are problems with the default snippets applying to all documents. It is not possible to add<snippet><tab> in a document even though the snippet is irrelevant to that filetype.
A recent conversation on the ML showed problems with the Haskell do snippet and shortly after I hit the problem adding "if<tab>" in a text document (Murphy I guess).
Basically having language specific snippets in the default section is just wrong.
Agreed.
The current defaults are C or C++ specific so in https://github.com/elextr/geany_stuff/raw/master/snippets.conf I moved them there and to Java, but I understand that other languages may want them as well so I decided to post here before committing.
First thing when I look at the file: it looks terribly repetitive! Maybe something in the style of filetype's sections copying ([name=othername]) would help having all this clearer, ending up with something like
I had started working on filetype-specific snippets here: https://github.com/codebrainz/geany/commit/9a635da79ecd9465c856ce9d02dd95c14...
This would let a `[snippets]` section be in the filetypes.* files and I think would support group copying like the `[styles]` section does.
It still needs some work, but it's a start.
Hey, great idea! :)
Cheers, Colomban
[...]
First thing when I look at the file: it looks terribly repetitive! Maybe something in the style of filetype's sections copying ([name=othername]) would help having all this clearer, ending up with something like
To be honest Colomban I expected that the various language enthusiasts would pop up proposals of more tailored versions for each of the languages. ie I didn't think they would stay repetitive.
I notice that I only posted to geany-devel, I will send to geany-users as well, we may get more feedback.
[C] if=... else=...
[C++=C] try=...
[Java=C++] [PHP=C++] [C#=C++] [Javascript=C++] ...
[Python] if=... else=...
[HTML] table=...
Needs to be implemented, but a first though make me think it'd make easier to have/configure per-filetype snippets.
What do you think?
*If* the repition is really correct then either this proposal or Matthews alternate proposal of moving the snippets to the filetype files is the long term solution.
But if the level of interest is indicated by the responses, then not many people use these snippets, so maybe it isn't worth the effort of either approach and just repeat things for now and possibly over time the definitions will diverge.
I'll collate suggestions, patches etc then commit.
Why keep an empty [Haskell] section?
Again I expected proposals for some proper Haskell ones, but again looks like no-one uses snippets much.
Of course possibly no-one uses snippets because ATM they are all C. Certainly they are pretty useless for C++ despite the language similarities, eg for(;;) is often iterator based in C++ not int i etc.
If we don't get much feedback from the user list I suggest just using the modified snippets.conf to stop the unwanted interference and not bothering with the effort to change code that isn't adding much value.
Cheers Lex
Cheers, Colomban _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
Lex Trotman wrote:
But if the level of interest is indicated by the responses, then not many people use these snippets,
I've been a Geany user for about 18 months. I code in C, C++, Ocaml and Haskell regularly and touch dozens of other languages semi regularly.
Personally I think languages like Haskell don't really need snippets as the language itself is already terse. However, the existing snippets that work for C/C++/Java/etc are actually a pain in the neck when coding Haskell.
In C and C++, the snippets don't get in my way, but I wouldn't miss them if they weren't there.
For HTML and XML I actually do like the snippets. They're sane and they help.
so maybe it isn't worth the effort of either approach and just repeat things for now and possibly over time the definitions will diverge.
I think this will be the case.
Why keep an empty [Haskell] section?
Again I expected proposals for some proper Haskell ones, but again looks like no-one uses snippets much.
The language is super terse, with little un-necessary punctuation. I'd be happy with no snippets. If I find something that should be a Haskell snippet I'll be sure to let you know.
Cheers, Erik
Lex Trotman wrote:
[...] But if the level of interest is indicated by the responses, then not many people use these snippets, so maybe it isn't worth the effort of either approach and just repeat things for now and possibly over time the definitions will diverge.
I certainly use snippets, but not the standard ones you're talking about. I use snippets for things I can't easily remember or are laborious to type out. e.g. I have some lorem ipsum as a default snippet under the key "lorem", cdata encapsulation for XML/HTML/PHP, and a bunch of classic ASP stuff under HTML for when I'm forced to work on that old crap because I can never remember how to use ADO prepared statements and recordsets efficiently :)
So yes, from my perspective these common snippets aren't all that interesting because they're so basic and not really all that much of a time saver, at least for any programmer who can type as fast as they can think. I wouldn't put too much effort into it.
As an aside, I reckon the most useful snippets would be regex search / replace snippets, because they really do something. I've pushed a few commonly typed regex search/replaces into (sh/sed|python) scripts that I can call from Send Selection To, but I have too many to fit under that list. So I still have a Cunning Plan (tm) to implement a regex snippets plugin someday, unless some kind soul beats me to it (hint!)