Skip to content

Commit

Permalink
Added configurable maximum cursor count
Browse files Browse the repository at this point in the history
  • Loading branch information
NonSpicyBurrito committed Oct 13, 2022
1 parent 167479c commit 5ff2f51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
6 changes: 5 additions & 1 deletion src/decoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5ff2f51

Please sign in to comment.