Skip to content

Commit

Permalink
Fix code lenses getting stuck when file is renamed
Browse files Browse the repository at this point in the history
This caused the editor to get a new "long title", thus causing the 
previous lenses to never be cleaned up.

References #460
  • Loading branch information
Gert-dev committed Sep 3, 2019
1 parent 680ece1 commit ee388bc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/CodeLensManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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] = [];
}
};

0 comments on commit ee388bc

Please sign in to comment.