From 5ff2f511bbdb27e6535f048ac9214c3a9716829d Mon Sep 17 00:00:00 2001 From: NonSpicyBurrito Date: Fri, 14 Oct 2022 04:11:43 +0800 Subject: [PATCH] Added configurable maximum cursor count --- package.json | 13 ++++++++++++- src/decoration.ts | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b44b379..e2d23bf 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,18 @@ "url": "https://github.com/NonSpicyBurrito/hoverlens.git" }, "main": "./dist/extension.js", - "contributes": {}, + "contributes": { + "configuration": { + "title": "Hover Lens", + "properties": { + "hoverlens.maximumCursorCount": { + "description": "Maximum cursor count which hover information will be displayed (set to 0 for unlimited).\nDisplaying hover information for too many cursors may degrade editor performance.", + "type": "number", + "default": 3 + } + } + } + }, "activationEvents": [ "onStartupFinished" ], diff --git a/src/decoration.ts b/src/decoration.ts index a50eeed..de6f1bd 100644 --- a/src/decoration.ts +++ b/src/decoration.ts @@ -10,7 +10,11 @@ export async function getDecorations( selections: readonly vscode.Selection[] ) { if (!selections.length) return [] - if (selections.length > 3) return [] + + const maxCount = vscode.workspace + .getConfiguration('hoverlens') + .get('maximumCursorCount', 3) + if (maxCount > 0 && selections.length > maxCount) return [] const positions = selections .map((selection) => selection.active)