From 8c611ad1218cfde4f87dede34977eda74ed23db5 Mon Sep 17 00:00:00 2001 From: Peter Retzlaff Date: Sat, 8 Dec 2018 18:19:35 +0100 Subject: [PATCH] Fix linter offenses not updating after re-opening a file. Need to check whether the document provided to the linter is still the same object as in previous runs. I.e. when closing and re-opening a file, the document object changes, so the existing linter object won't see updates to the content anymore. --- src/lint/lintCollection.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lint/lintCollection.ts b/src/lint/lintCollection.ts index c1c46b2ff..80243fd0c 100644 --- a/src/lint/lintCollection.ts +++ b/src/lint/lintCollection.ts @@ -23,7 +23,12 @@ export class LintCollection { public run(doc) { if (!doc) return; if (doc.languageId !== 'ruby') return; - if (!this._docLinters[doc.fileName]) this._docLinters[doc.fileName] = new Linter(doc, this._rootPath, this._update.bind(this, doc)); + if (!this._docLinters[doc.fileName] || this._docLinters[doc.fileName].doc != doc) + this._docLinters[doc.fileName] = new Linter( + doc, + this._rootPath, + this._update.bind(this, doc) + ); this._docLinters[doc.fileName].run(this._cfg); }