Skip to content

Commit

Permalink
fix: return a real destroyed decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed May 8, 2021
1 parent bd4eb25 commit 473d82c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/minimap.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
"use strict"

import { Emitter, CompositeDisposable, Disposable } from "atom"
import Decoration from "./decoration"
import StableAdapter from "./adapters/stable-adapter"
import { editorsMinimaps } from "./main"

let nextModelId = 1

// returned in the decorations API when minimap is destoryed
const destoryedDecorationMock = { destroyed: true }
const disposedDisposable = new Disposable()
disposedDisposable.dispose()
const markerMock = {
onDidDestroy: () => disposedDisposable,
getScreenRange: () => ({}),
}
const destoryedDecoration = new Decoration(markerMock, null, {})
destoryedDecoration.destroy()

/**
* The Minimap class is the underlying model of a <MinimapElement>.
Expand Down Expand Up @@ -1142,16 +1148,16 @@ export default class Minimap {
return this.getDecorationManagement()?.onDidUpdateDecoration(...args) ?? disposedDisposable
}
decorationForId(...args) {
return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecorationMock
return this.getDecorationManagement()?.decorationForId(...args) ?? destoryedDecoration
}
decorationsForScreenRowRange(...args) {
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecorationMock
return this.getDecorationManagement()?.decorationsForScreenRowRange(...args) ?? destoryedDecoration
}
decorationsByTypeThenRows() {
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecorationMock
return this.getDecorationManagement()?.decorationsByTypeThenRows() ?? destoryedDecoration
}
decorateMarker(...args) {
return this.getDecorationManagement()?.decorateMarker(...args)
return this.getDecorationManagement()?.decorateMarker(...args) ?? destoryedDecoration
}
removeDecoration(...args) {
return this.getDecorationManagement()?.removeDecoration(...args)
Expand Down

0 comments on commit 473d82c

Please sign in to comment.