more clear code

This commit is contained in:
Daniel Hung 2021-01-27 16:39:11 -08:00
parent b1944a8bad
commit f9b95016ee

View File

@ -10,6 +10,7 @@ import {
TextEditor,
TextEditorDecorationType,
TextEditorSelectionChangeEvent,
TextEditorSelectionChangeKind,
ThemeColor,
window,
workspace
@ -59,10 +60,13 @@ export default class KiteRelatedCodeDecorationsProvider {
return;
}
if (typeof(event.kind) !== 'undefined' && event.kind !== 1 && typeof(this.editTimeout) === 'undefined') {
if (typeof(this.editTimeout) === 'undefined' && (event.kind === TextEditorSelectionChangeKind.Command || event.kind === TextEditorSelectionChangeKind.Mouse)) {
// If timeout is not set (i.e. the decoration is already showing), and the cursor is moved by
// a non-edit event, then show the decoration immediately.
this.decorate(event);
} else {
// Otherwise, show the decoration after 1 second of inactivity.
this.clearDecorations(event.textEditor);
if (typeof(this.editTimeout) !== 'undefined') {