message: Fix lines in bibtex duplicate highlighting
diff: @@ -66,6 +66,14 @@ export class BibtexFormater {
  sortedEntryLocations = entryLocations
  }
  + // We need to figure out the line changes in order to highlight properly
  + const lineDeltas: number[] = new Array<number>(entryLocations.length)
  + let accumulatedDelta = 0
  + for (let i = 0; i < entryLocations.length; i++) {
  + lineDeltas[i] = accumulatedDelta
  + accumulatedDelta += (sortedEntryLocations[i].end.line - sortedEntryLocations[i].start.line) - (entryLocations[i].end.line - entryLocations[i].start.line)
  + }
  +
  // Successively replace the text in the current location from the sorted location
  const edit = new vscode.WorkspaceEdit()
  const uri = vscode.window.activeTextEditor.document.uri
  @@ -82,14 +90,21 @@ export class BibtexFormater {
  isDuplicate = duplicates.has(entries[i])
  if (isDuplicate && handleDuplicates !== 'Ignore Duplicates') {
  if (handleDuplicates === 'Highlight Duplicates') {
  + const highlightRange: vscode.Range = new vscode.Range(
  + entryLocations[i].start.line + lineDeltas[i],
  + entryLocations[i].start.character,
  + entryLocations[i].start.line + lineDeltas[i] + (sortedEntryLocations[i].end.line - sortedEntryLocations[i].start.line),
  + entryLocations[i].end.character
  + )
  diags.push(new vscode.Diagnostic(
  - entryLocations[i],
  + highlightRange,
  `Duplicate entry "${entries[i].internalKey}".`,
  vscode.DiagnosticSeverity.Warning
  ))
  } else { // 'Comment Duplicates'
  // Log duplicate entry since we aren't highlighting it
  - this.extension.logger.addLogMessage(`BibTeX-format: Duplicate entry "${entries[i].internalKey}" at line ${entryLocations[i].start.line + 1}.`)
  + this.extension.logger.addLogMessage(
  + `BibTeX-format: Duplicate entry "${entries[i].internalKey}" at line ${entryLocations[i].start.line + lineDeltas[i] + 1}.`)
  text = text.replace(/@/,'')
  }
  }
  