Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 550f399

Browse files
committed
Fix a race condition
Make it so if the editor contents have changed between when the lint was triggered and the results came back we simply tell Linter to not update the current messages, instead of attempting to mark up the contents based on the old (potentially leading to "invalid" ranges, that _were_ valid when the lint was triggered).
1 parent 641fd15 commit 550f399

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ export function provideLinter() {
6161

6262
const messages = HTMLHint.verify(fileText, ruleset || undefined);
6363

64+
if (editor.getText() !== fileText) {
65+
// Editor contents have changed, tell Linter not to update
66+
return null;
67+
}
68+
6469
return messages.map(message => ({
6570
range: rangeFromLineNumber(editor, message.line - 1, message.col - 1),
6671
type: message.type,

0 commit comments

Comments
 (0)