Set the OpenSCAD indenter to C-style instead of none.

Authored by mickaelbo on Aug 25 2019, 6:16 PM.



OpenSCAD uses braces enclosed blocks, you can see examples at .

The brace and indentation style is close to C (optional braces if there is only one sub statement and one-line blocks are allowed). Therefore, the C-style indenter is well fitted IMHO.

Side question: the C indenter indents the next line when a block keyword if found (for, if, etc.) even when no opening brace is typed. Is there a way to extend this list of indenter keywords for OpenSCAD (rotate, linear_extrude, etc.) ?

Diff Detail

R216 Syntax Highlighting
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
mickaelbo created this revision.Aug 25 2019, 6:16 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 25 2019, 6:16 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mickaelbo requested review of this revision.Aug 25 2019, 6:16 PM
mickaelbo updated this revision to Diff 64607.Aug 25 2019, 6:56 PM

Set the section to 3D and few style changes.

+1, this is nicer.

For the cstyle + additional keywords: at the moment there is no way to "automatically propagate that", but one could alter the js code to use different trigger words for different highlightings.

Btw., how do one see that this is nicer? Does the highlighting of the shipped test change?


If not, could more stuff be added there that shows the improvements?

Thank you for the "js way" to modify the indentation. I will have a look at this tomorrow.

From what I see, the *.scad* files in the autotest directory are exclusively related to hightlighting and folding, nothing is related to the indenter expected behavior (ie. indent as you type). Did I miss something ?

cullmann accepted this revision.Aug 25 2019, 9:31 PM

I see, I missed that you did only change the indentation of the file, I thought you did alter some highlighting rules, too ;)

This revision is now accepted and ready to land.Aug 25 2019, 9:31 PM

Can you pass me name + mail address for the commit?

Mickael Bosch

This revision was automatically updated to reflect the committed changes.