-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Refactors removal of text decorations to occur after recoloring
This fixes a bug related to flickering when clicking a previously-colored text editor window. #2
- Loading branch information
1 parent
e0812e3
commit bbf720d
Showing
4 changed files
with
53 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
import { | ||
textEditorDecorationMap, | ||
} from './cache' | ||
import { removePreviousTextEditorDecorations } from './removePreviousTextEditorDecorations' | ||
import { | ||
removeTextEditorDecorations, | ||
} from './removeTextEditorDecorations' | ||
|
||
export const removeAllTextEditorDecorations = () => { | ||
Array | ||
.from( | ||
textEditorDecorationMap | ||
.keys() | ||
.entries() | ||
) | ||
.forEach(( | ||
editor, | ||
) => { | ||
removePreviousTextEditorDecorations( | ||
editor | ||
.forEach(([ | ||
textEditor, | ||
textEditorDecorations, | ||
]) => { | ||
removeTextEditorDecorations( | ||
textEditorDecorations | ||
) | ||
|
||
textEditorDecorationMap | ||
.delete( | ||
textEditor | ||
) | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
TextEditorDecorationType, | ||
} from 'vscode' | ||
|
||
export const removeTextEditorDecorations = ( | ||
textEditorDecorations: ( | ||
Set< | ||
TextEditorDecorationType | ||
> | ||
), | ||
) => { | ||
Array | ||
.from( | ||
textEditorDecorations | ||
) | ||
.forEach(( | ||
textEditorDecoration, | ||
) => { | ||
textEditorDecoration | ||
.dispose() | ||
}) | ||
} |