Forum > Editor
code completion for case statements with enumerated types
(1/1)
Syndrome:
does lazarus support it?
Martin_fr:
you mean http://wiki.lazarus.freepascal.org/New_IDE_features_since#code_macro_OfAll ?
Syndrome:
--- Quote from: Martin_fr on March 01, 2018, 12:19:42 pm ---you mean http://wiki.lazarus.freepascal.org/New_IDE_features_since#code_macro_OfAll ?
--- End quote ---
Yes. Thank you. Sadly, it generates unaligned code, but this is better than manually enumerating all the values.
I left an alignment example below. It looks like the "code insertion" feature eats tabs - so i left comments describing the alignment.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure test_code_completion_for_case_statements;type enumerated_type = (a, b, c, d, e, f, g);var enum:enumerated_type;begin case enum of {<- manually aligned case statement} a: ; {<- aligned with 2 tabs} b: ; {<- aligned with 2 tabs} c: ; {<- aligned with 2 tabs} d: ; {<- aligned with 2 tabs} e: ; {<- aligned with 2 tabs} f: ; {<- aligned with 2 tabs} g: ; {<- aligned with 2 tabs} end; {<- aligned with 1 tab} case enum of {<- auto completed case statement} a: ; {<- aligned with 1 space + 1 tab} b: ; {<- aligned with 1 tab + 1 space} c: ; {<- aligned with 1 tab + 1 space} d: ; {<- aligned with 1 tab + 1 space} e: ; {<- aligned with 1 tab + 1 space} f: ; {<- aligned with 1 tab + 1 space} g: ; {<- aligned with 1 tab + 1 space} end; {<- keyword "end" aligned with 1 space}end;
Do you know how to modify built-in macros? I could try to fix this myself.
ASerge:
--- Quote from: Syndrome on March 01, 2018, 12:44:28 pm ---I left an alignment example below. It looks like the "code insertion" feature eats tabs - so i left comments describing the alignment.
Do you know how to modify built-in macros? I could try to fix this myself.
--- End quote ---
Lazarus 1.8.2, Windows, x64.
Auto completed case statement:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure Test;type TEnum = (a, b, c, d, e, f, g);var Enum: TEnum;begin Enum := a; case Enum of a: ; b: ; c: ; d: ; e: ; f: ; g: ; end;end;All correct.
Syndrome:
Lazarus 1.8.2. Windows 8.1 x64. All incorrect. I use tabs instead of spaces.
Navigation
[0] Message Index