In 2019.05...
The builtin editor gets some autoindent cases wrong. (Yes, I use the
built-in editor.)
Case A:
If you say
for (i=[1:10]) foo();
it thinks the next line should be indented.
Case B:
If you say
x = [
for (i=[1:10]) i
];
the first of all it'll try to indent the close-bracket line by two tab
stops (one more than the for()), but then it will try to indent
everything after that by one.
That is, if I type:
x = [ <Enter>
<Tab> for (i=[1:10]) i <Enter>
]; <Enter>
hello <Enter>
world
I get
x = [
for (i=[1:10]) i
];
hello
world
Worse, if I type
x = [ <Enter>
<Tab> for (i=[1:10]) i <Enter>
<Backtab><Backtab>]; <Enter>
hello <Enter>
world
then I get
x = [
for (i=[1:10]) i
];
hello
world
There are plenty of reasonable indentation styles, but I don't think
this aligns with any of them.
There's no urgency, but having discovered what looks like a bug I don't
want to just drop it.
Should I file a github issue?
On 16.03.20 02:37, Jordan Brown wrote:
Should I file a github issue?
Nope, more issues with the same topic will not help.
https://github.com/openscad/openscad/issues/2374
https://github.com/openscad/openscad/issues/1172
https://github.com/openscad/openscad/issues/1075
You could add the examples somewhere if they are not
covered yet. I don't know if there's much of a
chance to fix that though. Right now the editor is
using the existing C++ indentation which causes the
mismatch. Writing an OpenSCAD specific one is
probably not an easy topic. It certainly would be
nice to have of cause.
ciao,
Torsten.