ecode icon indicating copy to clipboard operation
ecode copied to clipboard

Auto-indent

Open Curculigo opened this issue 1 year ago • 4 comments

For example, you typed { and press enter, you will not want to have to type TAB manually. This is the most basic case, though. Please see how other editors are doing and copy. Thank you.

Curculigo avatar Jul 25 '24 18:07 Curculigo

Related to #67.

SpartanJ avatar Jul 25 '24 19:07 SpartanJ

Could you learn something from the implementations of other text editors?

https://github.com/tsujan/FeatherPad/tree/master/featherpad/highlighter

https://github.com/ScintillaOrg/lexilla/tree/master/lexers

Curculigo avatar Aug 25 '24 16:08 Curculigo

You have added support for code folding in https://github.com/SpartanJ/eepp/commit/851dfc3ccb0f44d475d76693a32154783e04c3cd. I think it will not be hard for you to add support for basic auto-indent.

Curculigo avatar Aug 25 '24 16:08 Curculigo

Could you learn something from the implementations of other text editors?

Not from Scintilla/lexilla since it doesn't support auto-indentation. And from Featherpad... IDK what you mean, auto-indentation on Featherpad works the same as ecode right now, it will keep the indentation from the previous line when you insert a new line, but that's it (I don't consider that true auto-indentation but it has always been more than enough for me). The only difference is that ecode does not allow to disable the auto-indentation since it's enabled by default and there's no option to disable it (i might have to add it but who doesn't want that).

You have added support for code folding in https://github.com/SpartanJ/eepp/commit/851dfc3ccb0f44d475d76693a32154783e04c3cd. I think it will not be hard for you to add support for basic auto-indent.

Auto-indentation does not depend on folding ranges, folding range won't exist while you write any new block of code, you cannot base the auto-indentation from that. True auto-indentation requires language specific code and usually some knowledge of the AST if possible. Also auto-indentation is very user-specific, best solution is supporting tree-sitter, but that won't come soon.

SpartanJ avatar Aug 25 '24 19:08 SpartanJ