vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

match of macro definition shows a false match

Open liuhuaibin opened this issue 3 years ago • 2 comments
trafficstars

Explain the issue

in systemverilog file , when you define a macro('ifdef 'else)and appear “if” ,the macro of else can match if and also match the 'ifdef.

if(a) begin 'ifdef 'else 'endif end

about match_word =''if(\n)?def>:'else>:'endif>,'

liuhuaibin avatar Jul 27 '22 08:07 liuhuaibin

What is the expectation?

I have opened file.sv as follows (did not customize match_words, using built-in vim).

if(a) begin
`ifdef 
else
`endif
end

Match 1:

if(a)
else

Match 2:

begin
end

Match 3:

`ifdef 
`endif

andymass avatar Jul 30 '22 17:07 andymass

First of all ,thank you very much for taking time out of your busy schedule to answer my question! About this question ,may be you can try it that put a macro symbol before the "else" . you can see , “'else” can match “ if ”,can also match “'ifdef” .So I got the idea, how do I tie the symbol of the macro to the if so that it doesn't match the else.

if(a) begin 'ifdef 'else 'endif end

Match 1: 'ifdef 'else 'endif

Match 2: if (a) else

Please try it , thank you!

liuhuaibin avatar Aug 04 '22 06:08 liuhuaibin