On 16.03.20 03:25, Jordan Brown wrote:
It might not be that big a deal.
The problem is that the options to hook into the existing
CPP lexer are limited. Maybe there are some ways to tweak
things to get at least some improvements.
I'll try to remember to look at it in my Copious Free
Time, now that I have a working OpenSCAD build environment.
If you give it a shot, feel free to reach out on IRC too
for more interactive discussion :-).
ciao,
Torsten.
I took a quick stab at just moving the keywords from one list to another.
Indeed, it seemed to change the indentation behavior - in my mind, for
the better. (But I can't claim to have comprehensively tested it.)
It also changed the color of the keywords I moved from green to blue.
It's clear that I don't understand what's really going on, because (for
instance) "module" is also in keywordSet[0], and it gets a different
indentation behavior. I just took a blind stab, saying "I want 'for' to
behave like 'union' " and so moved it into the same list. I didn't try
to understand the lexer.
diff --git a/src/scadlexer.cpp b/src/scadlexer.cpp
index b5b1a54d..8c9187e6 100644
--- a/src/scadlexer.cpp
+++ b/src/scadlexer.cpp
@@ -6,7 +6,7 @@ ScadLexer::ScadLexer(QObject *parent) : QsciLexerCPP(parent)
{
// -> Style: Keyword (lexer.l)
keywordSet[0] =
- "if else let for each module function true false undef "
+ "let each module function true false undef "
"include use assert";
// -> Style: KeywordSet2 (func.cc)
@@ -24,6 +24,7 @@ ScadLexer::ScadLexer(QObject *parent) : QsciLexerCPP(parent)
// -> Style: GlobalClass
keywordSet[3] =
+ "for if else"
"cube sphere cylinder polyhedron square circle polygon text "
"minkowski hull resize child children echo union difference "
"intersection linear_extrude rotate_extrude import group "