atsushieno / vscode-language-review

Re:VIEW language Support for Visual Studio Code. / issue/PRは日本語でも対応できます
Other
43 stars 8 forks source link

Duplicate-Label errors keep reported if you break a doc and fix it (and even after you reopen the file) #17

Closed muojp closed 6 years ago

muojp commented 6 years ago

I found a weird behavior about syntax checking (vscode 1.26.1 on Windows 10 + vscode-language-review 0.4.5).

Abstract

The extension keeps reporting syntax errors after you fix the problem. Furthermore, the errors persist after closing tab -> reopening the file unless you completely close the host editor window and reopen it.

Repro

Here's a simple repro:

Step 1: type in a tiny doc and save it to a file

= foo

== bar

text

Step 2: make the doc corrupt

= foo

=1= bar

text

Screenshot 1: image

Syntax checker performs as expected and reports error as red underlines (note: but I don't get why it says there are duplicated labels).

Step 3: fix the doc

= foo

== bar

text

Expected: Error vanishes Actual: Error persists like below

Screenshot 2: image

(bonus) Step 4: close the tab and reopen the file

Error persists (same as the Screenshot 2).

atsushieno commented 6 years ago

Hmm, it seems to be working fine for me. But my local vscode is 1.25.1 on Ubuntu (and vscode-language-review is 0.4.5), so it might be dependent on environment and/or versions. Or the operation was not exactly the same. I didn't try to save it. I will try 1.26.1 once I get good network connection.

screenrecording

muojp commented 6 years ago

Thanks for your quick checking. I tested on other Windows box (1.26.1+0.4.5) and got the same issue, and will test macOS later. I also confirmed the problem also occurs on redpen-enabled directory (I originally found the issue on untethered file).

muojp commented 6 years ago

Update: I confirmed the same weird behavior on vscode 1.26.1's on macOS (forgot version) & Ubuntu 18.04.1.

atsushieno commented 6 years ago

Yes, I could reproduce it with vscode 1.26.1. Looks like regression in VSCode.

jrieken commented 6 years ago

@atsushieno The problem is that you are always creating a new diagnostics collection without disposing the old one. See https://github.com/atsushieno/vscode-language-review/blob/90639541664bdab6ba8cb0b2c91853bf577dd6bf/src/preview.ts#L130. We have fixed a bug in VS Code that wouldn't show those duplicated collections and now after us fixing it, issues like this can surface.

atsushieno commented 6 years ago

@jrieken you're right, thanks a lot for the hint!