smartparens
smartparens copied to clipboard
Q: would be welcome contribution of language-specific additional syntax?
I see smartparens has language specific configurations, like smartparens-c.el file for C and C++. My question is: would it be welcome if I contribute rules which create more than just a paren/brace? Like a semicolon at the end of function call in C/C++, or a colon after a paren in Python.
I've got a local smartparens configuration which you can see here, which adds for C and C++ languages semicolons after parens whenever appropriate (so you write a function call like int a = foo(, and you get a completion with a semicolon like ();). There's also one that adds a lambda in C++ (you write [ and get [](){}, with a semicolon depending on circumstances), and one for python that adds a : if there's def on the line and the caret is at the end of the line, so you get def foo():.
I have used them for a while, and got very low number of misses. The only one I can remember offhand is the semicolon (); in C/C++ while you wanted to write a function implementation, so you wanted it to be () {. But the number of hits in this case is still much greater, because statistically more often one would write function calls inside a function body, which requires a semicolon at the end.
I would very much welcome this. The configurations are supposed to be somewhat opinionated, so I'm not as strict with accepting things which might be controversial. What you described all sounds sensible to be there.
Only the semicolon thing I personally probably wouldn't like. If we can hide that behaviour after some defcustom I see no problem accepting it though.
Only the semicolon thing I personally probably wouldn't like. If we can hide that behaviour after some
defcustomI see no problem accepting it though.
A defcustom that defaults to enabled or disabled?