Skip to content

Incorrect label line numbers when using macros/includes #39

@Hawkbat

Description

@Hawkbat

The start/end lines of labels are calculated by updating the current label's end line at the end of evaluation. However, if evaluation jumps into a macro or include, the line number will change to reflect the position in the new file rather than the last line in the old file, and the end and start line numbers can end up referring to completely different files.

I'm not sure how I want to resolve this. For the extension front-end (folding, selection ranges, etc.) the end line should be the last line before the include statement or macro call if a label/section is defined in that nested call, and otherwise calculated as it is now. However, for internal bookkeeping, it's more useful to have the 'true' end line, even if it's in a different file, in which case the symbol structure will need to be altered to retain file information along with the line numbers.

The most elegant way to handle both cases is probably to extend the state interface to use a stack of file/line/scope values instead of single values. When encountering another section/label, the stack can be crawled for the scope that the current section/label was defined in, and use the last line number from there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions