message: Add Viewer.findClient
diff: @@ -375,6 +375,19 @@ export class Viewer {
  this.extension.logger.addLogMessage(`Open external viewer for ${pdfFile}`)
  }
  + private findClient(pdfFilePath: string, websocket: ws): Client | undefined {
  + const clientSet = this.getClientSet(pdfFilePath)
  + if (clientSet === undefined) {
  + return
  + }
  + for (const client of clientSet) {
  + if (client.websocket === websocket) {
  + return client
  + }
  + }
  + return
  + }
  +
  /**
  * Handles the request from the internal PDF viewer.
  *
  @@ -390,7 +403,7 @@ export class Viewer {
  case 'open': {
  const clientSet = this.getClientSet(data.path)
  if (clientSet === undefined) {
  - return
  + break
  }
  const client = new Client(data.viewer, websocket)
  clientSet.add(client)
  @@ -400,14 +413,10 @@ export class Viewer {
  break
  }
  case 'request_params': {
  - const clientSet = this.getClientSet(data.path)
  - if (!clientSet) {
  + const client = this.findClient(data.path, websocket)
  + if (client === undefined) {
  break
  }
  - for (const client of clientSet) {
  - if (client.websocket !== websocket) {
  - continue
  - }
  const configuration = vscode.workspace.getConfiguration('latex-workshop')
  const invertType = configuration.get('view.pdf.invertMode.enabled') as string
  const invertEnabled = (invertType === 'auto' && (getCurrentThemeLightness() === 'dark')) ||
  @@ -435,7 +444,6 @@ export class Viewer {
  }
  this.extension.logger.addLogMessage(`Sending the settings of the PDF viewer for initialization: ${JSON.stringify(pack)}`)
  client.send(pack)
  - }
  break
  }
  case 'loaded': {
  