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

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

Details

Summary

OpenSCAD uses braces enclosed blocks, you can see examples at https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Commented_Example_Projects .

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

Repository
R216 Syntax Highlighting
Lint
Lint Skipped
Unit
Unit Tests Skipped
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?

(autotests/input/highlight.scad)

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?

Yup,
Mickael Bosch
mickael.bosch@linux.com
Thanks,

This revision was automatically updated to reflect the committed changes.