verilog_systemverilog.vim icon indicating copy to clipboard operation
verilog_systemverilog.vim copied to clipboard

Special instance indentation support

Open vhda opened this issue 9 years ago • 8 comments

@lewis could you check how hard it would be to support the following indentation in instances?

  my_module #(
    .PARAM1 (VALUE1),
    .PARAM2 (VALUE2),
    )
    u_my_instance(
      `ifdef TEST
      .port1 (wire1),
      `endif
      .port2 (wire2)
      );

vhda avatar May 18 '16 10:05 vhda

What's the current and what is the desired?

lewis6991 avatar May 18 '16 13:05 lewis6991

That's the desired. Try copying to Vim and open a new line after the instance, you will see that the indentation will match the offset introduced in the instance.

vhda avatar May 18 '16 13:05 vhda

What config do you have with this?

lewis6991 avatar May 18 '16 14:05 lewis6991

I currently get:

my_module #(
  .PARAM1 (VALUE1),
  .PARAM2 (VALUE2)
)
u_my_instance(
  .port1 (wire1),
  .port2 (wire2)
  );

logic a;

lewis6991 avatar May 18 '16 14:05 lewis6991

You need to keep the indentation of the instance exactly as I copied above and only indent after the instance.

vhda avatar May 18 '16 14:05 vhda

Seems fine for me ~~if I set b:verilog_dont_deindent_eos~~.

my_module #(
  .PARAM1 (VALUE1),
  .PARAM2 (VALUE2)
  )
  u_my_instance(
    .port1 (wire1),
    .port2 (wire2)
    );

logic a;

lewis6991 avatar May 18 '16 14:05 lewis6991

Ups! Needs an ifdef. I've edited my example above.

Sorry :)

vhda avatar May 18 '16 14:05 vhda

This won't be easy at all. I have a feeling there be may be a bug here around preprocessor statements.

lewis6991 avatar May 18 '16 15:05 lewis6991