message: Refactor bibWatcher a bit
diff: @@ -303,7 +303,7 @@ export class Manager {
  break
  }
  - let inputFilePath
  + let inputFilePath: string | null
  if (result[0].startsWith('\\subimport')) {
  inputFilePath = this.resolveFile([path.dirname(filePath)], path.join(result[1], result[2]))
  } else if (result[0].startsWith('\\import')) {
  @@ -312,7 +312,7 @@ export class Manager {
  inputFilePath = this.resolveFile([path.dirname(filePath), rootDir], result[2])
  }
  - if (fs.existsSync(inputFilePath)) {
  + if (inputFilePath && fs.existsSync(inputFilePath)) {
  this.texFileTree[filePath].add(inputFilePath)
  if (!fast && this.fileWatcher && this.filesWatched.indexOf(inputFilePath) < 0) {
  this.extension.logger.addLogMessage(`Adding ${inputFilePath} to file watcher.`)
  @@ -360,12 +360,10 @@ export class Manager {
  this.extension.logger.addLogMessage(`Cannot find .bib file ${bib}`)
  return
  }
  - if (bibPath) {
  this.extension.logger.addLogMessage(`Found .bib file ${bibPath}`)
  if (this.bibWatcher === undefined) {
  this.extension.logger.addLogMessage(`Creating file watcher for .bib files.`)
  - this.bibWatcher = chokidar.watch(bibPath)
  - this.bibsWatched.push(bibPath)
  + this.bibWatcher = chokidar.watch('')
  this.bibWatcher.on('change', (filePath: string) => {
  this.extension.logger.addLogMessage(`Bib file watcher - responding to change in ${filePath}`)
  this.extension.completer.citation.parseBibFile(filePath)
  @@ -376,8 +374,9 @@ export class Manager {
  this.bibWatcher.unwatch(filePath)
  this.bibsWatched.splice(this.bibsWatched.indexOf(filePath), 1)
  })
  - this.extension.completer.citation.parseBibFile(bibPath, rootFile)
  - } else if (this.bibsWatched.indexOf(bibPath) < 0) {
  + }
  +
  + if (this.bibsWatched.indexOf(bibPath) < 0) {
  this.extension.logger.addLogMessage(`Adding .bib file ${bibPath} to bib file watcher.`)
  this.bibWatcher.add(bibPath)
  this.bibsWatched.push(bibPath)
  @@ -390,7 +389,6 @@ export class Manager {
  this.extension.logger.addLogMessage(`.bib file ${bibPath} is already being watched.`)
  }
  }
  - }
  setEnvVar() {
  const configuration = vscode.workspace.getConfiguration('latex-workshop')
  