code-d icon indicating copy to clipboard operation
code-d copied to clipboard

Dub error highlighting is not "synchronised" with file's contents

Open unleashy opened this issue 4 years ago • 0 comments

On a fresh installation of code-d, this snippet has an error, undefined identifier 'notarealfunction', as expected.

void main() {
    notarealfunction();
    // squiggly line in the above line //
}

However, if you add an empty line above the error, like below, the squiggly error line "desynchronises" and ends up highlighting the empty line:

void main() {
    // squiggly line is here //
    notarealfunction();
}

When you save the file, the error "resynchronises". This happens with any change on the file that is above the line with a dub error; it also happens when you change a column that comes before the start column of the error.

Maybe the fix is to change dub errors' start lines and end lines when a line above them is added or removed (and doing the same for columns) so it's always synchronised without running dub as you type, which would destroy people's computers 😛

unleashy avatar Mar 14 '20 15:03 unleashy