From ee388bc07593dcb968b91f0620c58f1506962cf9 Mon Sep 17 00:00:00 2001 From: Gert Date: Tue, 3 Sep 2019 22:41:30 +0200 Subject: [PATCH] Fix code lenses getting stuck when file is renamed This caused the editor to get a new "long title", thus causing the previous lenses to never be cleaned up. References #460 --- lib/CodeLensManager.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/CodeLensManager.js b/lib/CodeLensManager.js index a0730233..eca3e09a 100644 --- a/lib/CodeLensManager.js +++ b/lib/CodeLensManager.js @@ -90,13 +90,11 @@ class CodeLensManager registerMarker(editor, range, options) { const marker = editor.markBufferRange(range, options); - const longTitle = editor.getLongTitle(); - - if (!(longTitle in this.markers)) { - this.markers[longTitle] = []; + if (!(editor.id in this.markers)) { + this.markers[editor.id] = []; } - this.markers[longTitle].push(marker); + this.markers[editor.id].push(marker); return marker; } @@ -105,13 +103,11 @@ class CodeLensManager * @param {TextEditor} editor */ removeMarkers(editor) { - const longTitle = editor.getLongTitle(); - - for (let i in this.markers[longTitle]) { - const marker = this.markers[longTitle][i]; + for (let i in this.markers[editor.id]) { + const marker = this.markers[editor.id][i]; marker.destroy(); } - this.markers[longTitle] = []; + this.markers[editor.id] = []; } };