message: Readjust log-parsing state-machine to exclude empty entry and include last entry in file
diff: @@ -94,11 +94,23 @@ export class Parser {
  this.buildLog = []
  let remainingEmptyLines = 0
  - let currentResult: {type: string, file: string, text: string, line: number|undefined } = {type: '', file: '', text: '', line: undefined}
  + const emptyResult = { type: '', file: '', text: '', line: undefined }
  + let currentResult: { type: string, file: string, text: string, line: number | undefined } = emptyResult
  for (const line of lines) {
  + // append the read line, since we have a corresponding result in the making
  + if (remainingEmptyLines > 0) {
  + currentResult.text = currentResult.text + " " + line
  + if (line.trim() === '') {
  + currentResult.text = currentResult.text + "\n"
  + remainingEmptyLines--
  + }
  + continue
  + }
  let result = line.match(latexBox)
  if (result) {
  + if (currentResult !== emptyResult) {
  this.buildLog.push(currentResult)
  + }
  currentResult = {
  type: 'typesetting',
  file: this.extension.manager.rootFile,
  @@ -110,7 +122,9 @@ export class Parser {
  }
  result = line.match(latexWarn)
  if (result) {
  + if (currentResult !== emptyResult) {
  this.buildLog.push(currentResult)
  + }
  currentResult = {
  type: 'warning',
  file: this.extension.manager.rootFile,
  @@ -122,23 +136,22 @@ export class Parser {
  }
  result = line.match(latexError)
  if (result) {
  + if (currentResult !== emptyResult) {
  this.buildLog.push(currentResult)
  + }
  currentResult = {
  type: 'error',
  text: (result[3] && result[3] !== 'LaTeX') ? `${result[3]}: ${result[4]}` : result[4],
  file: result[1] ? path.resolve(this.extension.manager.rootDir, result[1]) : this.extension.manager.rootFile,
  line: result[2] ? parseInt(result[2], 10) : undefined
  }
  - remainingEmptyLines = 2
  + remainingEmptyLines = 1
  continue
  }
  - // append the read line, since we probably don't have anything better to do with the log output...
  - if (remainingEmptyLines > 0) {
  - currentResult.text = currentResult.text + " " + line
  - if (line === '') {
  - remainingEmptyLines--
  - }
  }
  + // push final result
  + if (currentResult !== emptyResult) {
  + this.buildLog.push(currentResult)
  }
  this.extension.logger.addLogMessage(`LaTeX log parsed with ${this.buildLog.length} messages.`)
  this.showCompilerDiagnostics()
  