From 1f8d9dd4bdb659dae842d10715ffdd562245a33b Mon Sep 17 00:00:00 2001 From: Keegan Irby Date: Thu, 7 Nov 2024 19:56:07 -0800 Subject: [PATCH] Remove redundant range variable --- .../document/liveTailCodeLensProvider.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/core/src/awsService/cloudWatchLogs/document/liveTailCodeLensProvider.ts b/packages/core/src/awsService/cloudWatchLogs/document/liveTailCodeLensProvider.ts index 428a472b593..7c7bb1cd74c 100644 --- a/packages/core/src/awsService/cloudWatchLogs/document/liveTailCodeLensProvider.ts +++ b/packages/core/src/awsService/cloudWatchLogs/document/liveTailCodeLensProvider.ts @@ -24,10 +24,7 @@ export class LiveTailCodeLensProvider implements vscode.CodeLensProvider { } private buildClearDocumentCodeLens(document: vscode.TextDocument): vscode.CodeLens { - const range = new vscode.Range( - new vscode.Position(document.lineCount - 1, 0), - new vscode.Position(document.lineCount - 1, 0) - ) + const range = this.getBottomOfDocumentRange(document) const command: vscode.Command = { title: 'Clear document', command: 'aws.cwl.clearDocument', @@ -37,10 +34,7 @@ export class LiveTailCodeLensProvider implements vscode.CodeLensProvider { } private buildStopTailingCodeLens(document: vscode.TextDocument): vscode.CodeLens { - const range = new vscode.Range( - new vscode.Position(document.lineCount - 1, 0), - new vscode.Position(document.lineCount - 1, 0) - ) + const range = this.getBottomOfDocumentRange(document) const command: vscode.Command = { title: 'Stop tailing', command: 'aws.cwl.stopTailingLogGroup', @@ -48,4 +42,11 @@ export class LiveTailCodeLensProvider implements vscode.CodeLensProvider { } return new vscode.CodeLens(range, command) } + + private getBottomOfDocumentRange(document: vscode.TextDocument): vscode.Range { + return new vscode.Range( + new vscode.Position(document.lineCount - 1, 0), + new vscode.Position(document.lineCount - 1, 0) + ) + } }