From 2d9533b31f981823d8962716ba1d462beedd3c11 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Mon, 21 Sep 2020 12:02:13 +0200 Subject: [PATCH 1/2] feat: show code lenses before a playground block VSCODE-175 --- src/editors/playgroundController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editors/playgroundController.ts b/src/editors/playgroundController.ts index e786380eb..82a247431 100644 --- a/src/editors/playgroundController.ts +++ b/src/editors/playgroundController.ts @@ -117,7 +117,7 @@ export default class PlaygroundController { selectedText.length >= lastSelectedLine.length ) { this._partialExecutionCodeLensProvider?.refresh( - new vscode.Range(item.end.line + 1, 0, item.end.line + 1, 0) + new vscode.Range(item.start.line, 0, item.start.line, 0) ); } else { this._partialExecutionCodeLensProvider?.refresh(); From 185277e3d3e5ba32bf11505cc518cc5bf5e15578 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Mon, 21 Sep 2020 14:38:05 +0200 Subject: [PATCH 2/2] fix: show code lenses above the highest line of multiple selections --- src/editors/playgroundController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editors/playgroundController.ts b/src/editors/playgroundController.ts index 82a247431..b37b4f03a 100644 --- a/src/editors/playgroundController.ts +++ b/src/editors/playgroundController.ts @@ -111,13 +111,15 @@ export default class PlaygroundController { const selectedText = this.getSelectedText(item).trim(); const lastSelectedLine = this._activeTextEditor?.document.lineAt(item.end.line).text.trim() || ''; + const selections = this._activeTextEditor?.selections.sort((a, b) => (a.start.line > b.start.line ? 1 : -1)); + const firstLine = selections ? selections[0].start.line : 0; if ( selectedText.length > 0 && selectedText.length >= lastSelectedLine.length ) { this._partialExecutionCodeLensProvider?.refresh( - new vscode.Range(item.start.line, 0, item.start.line, 0) + new vscode.Range(firstLine, 0, firstLine, 0) ); } else { this._partialExecutionCodeLensProvider?.refresh();