diff --git a/package.json b/package.json index 53da3b9465..0cf02ee4c5 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,11 @@ "default": 100, "description": "How long in milliseconds to show a pending edit decoration" }, + "cursorless.decorationDebounceDelay": { + "type": "integer", + "default": 175, + "description": "How long in milliseconds to wait to redraw the hats after an action" + }, "cursorless.hatSizeAdjustment": { "type": "number", "default": 0, diff --git a/src/core/HatAllocator.ts b/src/core/HatAllocator.ts index f623731f49..b5119ad1ab 100644 --- a/src/core/HatAllocator.ts +++ b/src/core/HatAllocator.ts @@ -1,6 +1,5 @@ import * as vscode from "vscode"; import { addDecorationsToEditors } from "../util/addDecorationsToEditor"; -import { DECORATION_DEBOUNCE_DELAY } from "../core/constants"; import { Graph } from "../typings/Types"; import { Disposable } from "vscode"; import { IndividualHatMap } from "./IndividualHatMap"; @@ -72,11 +71,15 @@ export class HatAllocator { clearTimeout(this.timeoutHandle); } + const decorationDebounceDelay = vscode.workspace + .getConfiguration("cursorless") + .get("decorationDebounceDelay")!; + this.timeoutHandle = setTimeout(() => { this.addDecorations(); this.timeoutHandle = null; - }, DECORATION_DEBOUNCE_DELAY); + }, decorationDebounceDelay); } private toggleDecorations() { diff --git a/src/core/constants.ts b/src/core/constants.ts index 9dbd446e49..a96416cdc4 100644 --- a/src/core/constants.ts +++ b/src/core/constants.ts @@ -1,7 +1,5 @@ export const SUBWORD_MATCHER = /[A-Z]?[a-z]+|[A-Z]+(?![a-z])|[0-9]+/g; -export const DECORATION_DEBOUNCE_DELAY = 175; - export const HAT_COLORS = [ "default", "blue",