I'm very wondered how does "smart indentation" feature work. If previous line is empty, it removes indent assuming that single empty line is an empty indent. Smart indentation for multiple lines is absolutely awful: it doesn't take into account internal sub-indents and makes selection "flat".
Is anybody using this?
Under "smart" indentation people assume astyle, php-beautifier and so on: http://stackoverflow.com/questions/18828162/smart-auto-indentation-available...
-- Best regards, Pavel Roschin aka RPG
Le 25/07/2014 21:33, Pavel Roschin a écrit :
I'm very wondered how does "smart indentation" feature work. If previous line is empty, it removes indent assuming that single empty line is an empty indent. Smart indentation for multiple lines is absolutely awful: it doesn't take into account internal sub-indents and makes selection "flat".
It's a lie, this feature isn't smart, it just sets the same indentation than the previous line.
Is anybody using this?
I doubt it
Under "smart" indentation people assume astyle, php-beautifier and so on: http://stackoverflow.com/questions/18828162/smart-auto-indentation-available...
Yeah, we know we should have a nice (and complex) system for configurable smart indentation, but every time we tried to think about it we discovered that some languages are so crazy that it's really not simple, and probably would require some specific code for some languages (did I say Haskell?). And nobody did the filetypes plugins yet :(
However, you might be able to use some indenters tools from Geany using custom commands to some extent. In a similar way, I once started a multi-indernters plugin, but I didn't finish it for various reasons, one being my lack of much interest in it (I'd rather work on a solution for configurable and nice thing for Geany than on wrapping gnuindent, astyle or others, tools I never really used). If anyone is interested, it's here: https://github.com/b4n/grind
Regards, Colomban
On 14-07-25 01:01 PM, Colomban Wendling wrote:
Le 25/07/2014 21:33, Pavel Roschin a écrit :
I'm very wondered how does "smart indentation" feature work. If previous line is empty, it removes indent assuming that single empty line is an empty indent. Smart indentation for multiple lines is absolutely awful: it doesn't take into account internal sub-indents and makes selection "flat".
It's a lie, this feature isn't smart, it just sets the same indentation than the previous line.
Is anybody using this?
I doubt it
Under "smart" indentation people assume astyle, php-beautifier and so on: http://stackoverflow.com/questions/18828162/smart-auto-indentation-available...
Yeah, we know we should have a nice (and complex) system for configurable smart indentation, but every time we tried to think about it we discovered that some languages are so crazy that it's really not simple, and probably would require some specific code for some languages (did I say Haskell?). And nobody did the filetypes plugins yet :(
However, you might be able to use some indenters tools from Geany using custom commands to some extent. In a similar way, I once started a multi-indernters plugin, but I didn't finish it for various reasons, one being my lack of much interest in it (I'd rather work on a solution for configurable and nice thing for Geany than on wrapping gnuindent, astyle or others, tools I never really used). If anyone is interested, it's here: https://github.com/b4n/grind
And for "smart" indentation/formatting, I have written a plugin which works with C, C++, Objective-C (and I think I remember they talked about JS support) by using clang-format. See:
http://codebrainz.github.io/code-format/
Cheers, Matthew Brush
I use the "smart indentation" feature and I think it works fine the way it is. It may not be perfect, but in most cases it does exactly what it's supposed to.
On July 25, 2014 3:28:21 PM PDT, Matthew Brush mbrush@codebrainz.ca wrote:
On 14-07-25 01:01 PM, Colomban Wendling wrote:
Le 25/07/2014 21:33, Pavel Roschin a écrit :
I'm very wondered how does "smart indentation" feature work. If
previous line
is empty, it removes indent assuming that single empty line is an
empty indent.
Smart indentation for multiple lines is absolutely awful: it doesn't
take into
account internal sub-indents and makes selection "flat".
It's a lie, this feature isn't smart, it just sets the same
indentation
than the previous line.
Is anybody using this?
I doubt it
Under "smart" indentation people assume astyle, php-beautifier and
so on:
http://stackoverflow.com/questions/18828162/smart-auto-indentation-available...
Yeah, we know we should have a nice (and complex) system for configurable smart indentation, but every time we tried to think
about
it we discovered that some languages are so crazy that it's really
not
simple, and probably would require some specific code for some
languages
(did I say Haskell?). And nobody did the filetypes plugins yet :(
However, you might be able to use some indenters tools from Geany
using
custom commands to some extent. In a similar way, I once started a multi-indernters plugin, but I didn't finish it for various reasons,
one
being my lack of much interest in it (I'd rather work on a solution
for
configurable and nice thing for Geany than on wrapping gnuindent,
astyle
or others, tools I never really used). If anyone is interested, it's here: https://github.com/b4n/grind
And for "smart" indentation/formatting, I have written a plugin which works with C, C++, Objective-C (and I think I remember they talked about JS support) by using clang-format. See:
http://codebrainz.github.io/code-format/
Cheers, Matthew Brush
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
I agree that I like "smart indentation", although it does seem to do one thing that I didn't expect: auto-indent and unindent on curly braces. I'm more used to just preserving the previous line's indentation without special casing curly braces. Anybody know if there is a way to just get flat indentation without this special case?
On 07/25/2014 07:33 PM, Tory Gaurnier wrote:
I use the "smart indentation" feature and I think it works fine the way it is. It may not be perfect, but in most cases it does exactly what it's supposed to.
On July 25, 2014 3:28:21 PM PDT, Matthew Brush mbrush@codebrainz.ca wrote:
On 14-07-25 01:01 PM, Colomban Wendling wrote: Le 25/07/2014 21:33, Pavel Roschin a écrit : I'm very wondered how does "smart indentation" feature work. If previous line is empty, it removes indent assuming that single empty line is an empty indent. Smart indentation for multiple lines is absolutely awful: it doesn't take into account internal sub-indents and makes selection "flat". It's a lie, this feature isn't smart, it just sets the same indentation than the previous line. Is anybody using this? I doubt it Under "smart" indentation people assume astyle, php-beautifier and so on: http://stackoverflow.com/questions/18828162/smart-auto-indentation-available-in-geany Yeah, we know we should have a nice (and complex) system for configurable smart indentation, but every time we tried to think about it we discovered that some languages are so crazy that it's really not simple, and probably would require some specific code for some languages (did I say Haskell?). And nobody did the filetypes plugins yet :( However, you might be able to use some indenters tools from Geany using custom commands to some extent. In a similar way, I once started a multi-indernters plugin, but I didn't finish it for various reasons, one being my lack of much interest in it (I'd rather work on a solution for configurable and nice thing for Geany than on wrapping gnuindent, astyle or others, tools I never really used). If anyone is interested, it's here: https://github.com/b4n/grind And for "smart" indentation/formatting, I have written a plugin which works with C, C++, Objective-C (and I think I remember they talked about JS support) by using clang-format. See: http://codebrainz.github.io/code-format/ Cheers, Matthew Brush ------------------------------------------------------------------------ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Le 28/07/2014 17:18, Steven Blatnick a écrit :
I agree that I like "smart indentation", although it does seem to do one thing that I didn't expect: auto-indent and unindent on curly braces. I'm more used to just preserving the previous line's indentation without special casing curly braces. Anybody know if there is a way to just get flat indentation without this special case?
You mean auto-indentation upon typing, right? AFAIK, the OP talked about the *Edit->Format->Smart Line Indent* feature instead.
Anyway, to have the auto-indentation do what you ask (e.g. be dumber :)) go in the preferences to *Editor->Indentation* and set *Auto-indent mode* to *Basic*.
Regards, Colomban
Thanks! (Note to anyone else that may be looking at that setting: Project indentation settings overwrite the global ones.)
On 07/28/2014 09:25 AM, Colomban Wendling wrote:
Le 28/07/2014 17:18, Steven Blatnick a écrit :
I agree that I like "smart indentation", although it does seem to do one thing that I didn't expect: auto-indent and unindent on curly braces. I'm more used to just preserving the previous line's indentation without special casing curly braces. Anybody know if there is a way to just get flat indentation without this special case?
You mean auto-indentation upon typing, right? AFAIK, the OP talked about the *Edit->Format->Smart Line Indent* feature instead.
Anyway, to have the auto-indentation do what you ask (e.g. be dumber :)) go in the preferences to *Editor->Indentation* and set *Auto-indent mode* to *Basic*.
Regards, Colomban _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Am 25.07.2014 22:01, schrieb Colomban Wendling:
Yeah, we know we should have a nice (and complex) system for configurable smart indentation, but every time we tried to think about it we discovered that some languages are so crazy that it's really not simple, and probably would require some specific code for some languages (did I say Haskell?). And nobody did the filetypes plugins yet :(
The new plugin system I'm working on (the libpeas-based approach) might enable filetypes plugin with very little effort. In fact this is something I'm envisioning for this.
On 26 July 2014 05:33, Pavel Roschin roshin@scriptumplus.ru wrote:
I'm very wondered how does "smart indentation" feature work. If previous line is empty, it removes indent assuming that single empty line is an empty indent. Smart indentation for multiple lines is absolutely awful: it doesn't take into account internal sub-indents and makes selection "flat".
Is anybody using this?
Under "smart" indentation people assume astyle, php-beautifier and so on: http://stackoverflow.com/questions/18828162/smart-auto-indentation-available...
Indentation is one of *those* issues, everybody and every language wants to do it their way :)
Even just C/C++ has GNU, Kernel, Stroustrup, Geany and more "standard" ways, and many well meaning projects do something else to make it "look better". Attempts to use simple regular expression based techniques were easily foiled by alignment on continued expressions, so even for simple languages like C/C++ more complete analysis is needed as Matthew's libclang based system does.
Then the "offside" languages require specific indentation to infer structure, of course thats Python, and as mentioned, Haskell has an "interesting" set of rules.
The only way of supporting exactly what everyone wants is to allow them to have their own code to do it for their "standard" and their language (Colomban's filetype plugins).
Loading plugins as part of loading filetypes is easy (see https://github.com/elextr/geany/tree/filetype_plugins for a technology demonstrator I made ages ago) but no agreement was reached on the interface between Geany and the plugin (ranging from "most indentation done in Geany and the plugin tweaking it" to "here's the buffer, have fun"). And that also means new languages/styles need code, not just configuration.
And of course the concern with using external Astyle, Indent and to a lesser extent libclang, is the performance question for code that runs whilst the user is typing, and its ability to handle incomplete constructs (see Emacs autoindentation that happens later when you complete a construct, very confusing).
And then there is the problem of auto-indentation whilst re-structuring code.
To summarise, its complicated, and Geany is reluctant to implement and maintain something that makes only a marginal improvement or that has significant downsides.
One day somebody will have a Eureka moment :)
Cheers Lex
-- Best regards, Pavel Roschin aka RPG _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel