Code indentation not matched for begin, end; and if, end if; blocks

thwclw

Member
Can someone please tell me how to set up preferences so the block beginning and end align for begin and if?

For example, if I enter an "if" condition followed by "end if;" I would expect the "end if;" to automatically align with the same column as the beginning "if" - it does not behave that way.

The "end if;" aligns with the last line of code in the block instead of the beginning "if" looking like this:

begin
..v_new_value_num := get_number_copies(v_template_name);
..if v_new_value_num is null then
....dsp_message('Null value returned','E');
....end if;
....end;

This is what I would expect:

begin
..v_new_value_num := get_number_copies(v_template_name);
..if v_new_value_num is null then
....dsp_message('Null value returned','E');
..end if;
end;

I'm sure I'm just missing a setting somewhere, but I have not found it yet - any help would be appreciated!

Thanks,

Terry
 
An "end if" will indeed not automatically by unindented to match the "if". You will need to unindent before typing "end if".
 
What I do is set up the beautifier how I like. Then, I just slop the code in not caring about indentation or anything too much, compile it to make sure it's syntactically correct, press the button and it looks like I've spent all day doing nothing but making it pretty.

I also use templates for loops, procedures and stuff so I have less typing. Things are aligned because of the template as well. Then I use auto-replace to call the template. It could work for if/then/end-if stuff. I have an asterisk at the end of my auto-replace stuff so it only replaces when I want. For example, iff* for if/end if, and p* for a procedure block.

It takes time to set up, but I've saved lots of time using it.
 
Last edited:
Back
Top