4coder»Forums
John
1 posts
Virtual whitespace creates too much whitespace in function calls
Edited by John on
I want:
1
2
3
4
5
hello_how_are_you(
    x,
    y,
    z
);

but I get:
1
2
3
4
5
hello_how_are_you(
                  x,
                  y,
                  z
                  );


Would be nice if you added an option for that in config.4coder. :-)

Also with virtual whitespace disabled there is no way to indent multiple lines, or even a single line, you have to spam spacebar/backspace which is annoying. It's impossible to please everybody with auto formatting so unless the editor is good enough with auto formatting/virtual whitespace disabled, only those who like how it exactly is will use 4coder.

I tried to change the indentation behaviour and add a tab command using the customization layer myself, but I failed because I didn't understand the code. [Edit]: I have now managed to create working "tab commands". :-)

TY.
Simon Anciaux
1337 posts
Virtual whitespace creates too much whitespace in function calls
There is a layout hook (in 4coder_default_hooks.cpp) that should allow you to customize indentation (I think, I've never used it). The layout code is in 4coder_layout_rule.cpp and 4coder_layout_rule.h. But I just tried to use it and it seems that it doesn't work as the layout hook seems to only be called on application startup and never after. I'll report that on github.
Daniel
1 posts
Virtual whitespace creates too much whitespace in function calls
In case anyone else is having this issue, here is a diff I created to solve this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- 4coder_code_index.cpp	2020-12-06 05:19:17.948323207 -0500
+++ 4coder_code_index_new.cpp	2020-12-06 05:27:28.017456567 -0500
@@ -798,6 +798,7 @@
     f32 result = 0.f;
     if (nest != 0){
         switch (nest->kind){
+            case CodeIndexNest_Paren:
             case CodeIndexNest_Scope:
             case CodeIndexNest_Preprocessor:
             {
@@ -816,12 +817,6 @@
                     result += regular_indent;
                 }
             }break;
-            
-            case CodeIndexNest_Paren:
-            {
-                Rect_f32 box = layout_reflex_get_rect(app, reflex, nest->open.max - 1, unresolved_dependence);
-                result = box.x1;
-            }break;
         }
     }
     return(result);

Just apply this diff to 4coder_code_index.cpp.
Essentially I move the CodeIndexNest_Paren case to the CodeIndexNest_Scope case.