Skip to content

Commit 235f7fd

Browse files
VSCODE-175: show code lenses before a playground block (#170)
* feat: show code lenses before a playground block VSCODE-175 * fix: show code lenses above the highest line of multiple selections
1 parent d65e7f7 commit 235f7fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/editors/playgroundController.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ export default class PlaygroundController {
111111
const selectedText = this.getSelectedText(item).trim();
112112
const lastSelectedLine =
113113
this._activeTextEditor?.document.lineAt(item.end.line).text.trim() || '';
114+
const selections = this._activeTextEditor?.selections.sort((a, b) => (a.start.line > b.start.line ? 1 : -1));
115+
const firstLine = selections ? selections[0].start.line : 0;
114116

115117
if (
116118
selectedText.length > 0 &&
117119
selectedText.length >= lastSelectedLine.length
118120
) {
119121
this._partialExecutionCodeLensProvider?.refresh(
120-
new vscode.Range(item.end.line + 1, 0, item.end.line + 1, 0)
122+
new vscode.Range(firstLine, 0, firstLine, 0)
121123
);
122124
} else {
123125
this._partialExecutionCodeLensProvider?.refresh();

0 commit comments

Comments
 (0)