then the offset for the diagnostic (e.g. undefined variable) is wrong. It starts at the correct offset, but the length is calculated for #VARIABLE instead of &1& for the additional diagnostic info within the copycode.
We might be able to remember the positions where parameters were exchanged for passed stuff and on adding diagnostics look up the length of the parameter definition (e.g. &1&).
Also, if the issue was on 'Hi', then the offset would be broken because the token shifts by parameter length.
❗ Might be worth to create a tool to print a source with all copycodes "included"
[ ] Correctly annotate the parameter as problem
[ ] Fix offsets of stuff in the line after the parameter
If a copycode specifies:
and I pass a variable:
INCLUDE CC '#VARIABLE'
then the offset for the diagnostic (e.g. undefined variable) is wrong. It starts at the correct offset, but the length is calculated for
#VARIABLE
instead of&1&
for the additional diagnostic info within the copycode.We might be able to remember the positions where parameters were exchanged for passed stuff and on adding diagnostics look up the length of the parameter definition (e.g.
&1&
).Also, if the issue was on
'Hi'
, then the offset would be broken because the token shifts by parameter length.❗ Might be worth to create a tool to print a source with all copycodes "included"