Skip to content

Commit

Permalink
fix out of range error nan
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmacarthy committed Feb 28, 2024
1 parent 51c2868 commit e36103e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/extension/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ export class CompletionProvider implements InlineCompletionItemProvider {
const averageLine =
activeLines.reduce((acc, curr) => acc + curr.line, 0) /
activeLines.length
const start = new Position(Math.max(0, Math.ceil(averageLine) - 100), 0)
const end = new Position(Math.min(lineCount, Math.ceil(averageLine) + 100), 0)
const start = new Position(Math.max(0, Math.ceil(averageLine || 0) - 100), 0)
const end = new Position(Math.min(lineCount, Math.ceil(averageLine || 0) + 100), 0)
fileChunks.push(`
// File: ${filePath}
// Content: \n ${document.getText(new Range(start, end))}
Expand Down

0 comments on commit e36103e

Please sign in to comment.