Skip to content

Commit

Permalink
fix: Number.MAX_VALUE shows marker to end-of-line
Browse files Browse the repository at this point in the history
  • Loading branch information
kgilpin committed May 13, 2022
1 parent 3b85580 commit b60bef7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/resolvedFinding.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as vscode from 'vscode';
import { Finding } from '@appland/scanner/built/cli';
import { resolveFilePath } from './util';
import { promisify } from 'util';
import { readFile } from 'fs';

class StackFrameIndex {
locationByFrame = new Map<string, vscode.Location>();
Expand Down Expand Up @@ -113,15 +111,11 @@ export class ResolvedFinding {
const filePath = await resolveFilePath(folder.uri.fsPath, fileName);
if (!filePath) return;

const fileContents = await promisify(readFile)(filePath);
const lineContents = fileContents.toString().split('\n')[Number(line) - 1];
const lineWidth = lineContents ? lineContents.length : 1;

return new vscode.Location(
vscode.Uri.file(filePath),
new vscode.Range(
new vscode.Position(Number(line) - 1, 0),
new vscode.Position(Number(line) - 1, lineWidth)
new vscode.Position(Number(line) - 1, Number.MAX_VALUE)
)
);
}
Expand Down

0 comments on commit b60bef7

Please sign in to comment.