mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2024-10-04 23:27:20 +03:00
Move watchers to cacher
This commit is contained in:
parent
6fa467d6b4
commit
1975d66bc3
@ -126,7 +126,7 @@ export class Builder {
|
||||
this.lastBuild = Date.now()
|
||||
|
||||
if (rootFile) {
|
||||
this.extension.manager.ignorePdfFile(rootFile)
|
||||
this.extension.cacher.ignorePdfFile(rootFile)
|
||||
}
|
||||
|
||||
await vscode.workspace.saveAll()
|
||||
@ -162,7 +162,7 @@ export class Builder {
|
||||
|
||||
// Stop watching the PDF file to avoid reloading the PDF viewer twice.
|
||||
// The builder will be responsible for refreshing the viewer.
|
||||
this.extension.manager.ignorePdfFile(rootFile)
|
||||
this.extension.cacher.ignorePdfFile(rootFile)
|
||||
|
||||
await vscode.workspace.saveAll()
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as vscode from 'vscode'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as chokidar from 'chokidar'
|
||||
import { latexParser } from 'latex-utensils'
|
||||
|
||||
import type { CmdEnvSuggestion } from '../providers/completer/completerutils'
|
||||
@ -15,6 +14,9 @@ import * as utils from '../utils/utils'
|
||||
import { InputFileRegExp } from '../utils/inputfilepath'
|
||||
import { canContext, isExcluded, parseFlsContent } from './cacherlib/cacherutils'
|
||||
import { PathUtils } from './cacherlib/pathutils'
|
||||
import { Watcher } from './cacherlib/texwatcher'
|
||||
import { PdfWatcher } from './cacherlib/pdfwatcher'
|
||||
import { BibWatcher } from './cacherlib/bibwatcher'
|
||||
|
||||
export interface Context {
|
||||
/**
|
||||
@ -55,10 +57,11 @@ export interface Context {
|
||||
export class Cacher {
|
||||
private readonly contexts: {[filePath: string]: Context} = {}
|
||||
private readonly watcher: Watcher = new Watcher(this.extension, this)
|
||||
private readonly pdfWatcher: PdfWatcher = new PdfWatcher(this.extension)
|
||||
private readonly bibWatcher: BibWatcher = new BibWatcher(this.extension)
|
||||
private readonly pathUtils: PathUtils = new PathUtils(this.extension)
|
||||
|
||||
constructor(private readonly extension: Extension) {
|
||||
}
|
||||
constructor(private readonly extension: Extension) {}
|
||||
|
||||
add(filePath: string) {
|
||||
if (isExcluded(filePath)) {
|
||||
@ -85,6 +88,8 @@ export class Cacher {
|
||||
|
||||
async dispose() {
|
||||
await this.watcher.watcher.close()
|
||||
await this.pdfWatcher.dispose()
|
||||
await this.bibWatcher.dispose()
|
||||
}
|
||||
|
||||
async refreshContext(filePath: string, rootPath?: string) {
|
||||
@ -183,7 +188,7 @@ export class Cacher {
|
||||
}
|
||||
this.contexts[filePath].bibfiles.push(bibPath)
|
||||
this.extension.logger.addLogMessage(`[Cacher] Bib ${bibPath} from ${filePath}.`)
|
||||
await this.extension.manager.bibWatcher.watchBibFile(bibPath)
|
||||
await this.bibWatcher.watchBibFile(bibPath)
|
||||
}
|
||||
}
|
||||
this.extension.logger.addLogMessage(`[Cacher] Updated bibs of ${filePath}.`)
|
||||
@ -311,7 +316,7 @@ export class Cacher {
|
||||
if (rootFile && !this.getCachedContent(rootFile).bibfiles.includes(bibPath)) {
|
||||
this.getCachedContent(rootFile).bibfiles.push(bibPath)
|
||||
}
|
||||
await this.extension.manager.bibWatcher.watchBibFile(bibPath)
|
||||
await this.bibWatcher.watchBibFile(bibPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,103 +438,14 @@ export class Cacher {
|
||||
})
|
||||
return children
|
||||
}
|
||||
}
|
||||
|
||||
class Watcher {
|
||||
readonly watcher: chokidar.FSWatcher
|
||||
readonly watched: Set<string> = new Set()
|
||||
|
||||
constructor(
|
||||
private readonly extension: Extension,
|
||||
private readonly cacher: Cacher
|
||||
) {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
const watcherOption = {
|
||||
useFsEvents: false,
|
||||
usePolling: configuration.get('latex.watch.usePolling') as boolean,
|
||||
interval: configuration.get('latex.watch.interval') as number,
|
||||
binaryInterval: Math.max(configuration.get('latex.watch.interval') as number, 1000),
|
||||
awaitWriteFinish: {stabilityThreshold: configuration.get('latex.watch.delay') as number}
|
||||
}
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher]Create watcher: ${JSON.stringify(watcherOption)}`)
|
||||
this.watcher = chokidar.watch([], watcherOption)
|
||||
|
||||
this.watcher.on('add', (file: string) => this.onAdd(file))
|
||||
this.watcher.on('change', (file: string) => this.onChange(file))
|
||||
this.watcher.on('unlink', (file: string) => this.onUnlink(file))
|
||||
|
||||
this.registerOptionReload()
|
||||
ignorePdfFile(rootFile: string) {
|
||||
const pdfFilePath = this.extension.manager.tex2pdf(rootFile)
|
||||
const pdfFileUri = vscode.Uri.file(pdfFilePath)
|
||||
this.pdfWatcher.ignorePdfFile(pdfFileUri)
|
||||
}
|
||||
|
||||
add(filePath: string) {
|
||||
this.watcher.add(filePath)
|
||||
this.watched.add(filePath)
|
||||
}
|
||||
|
||||
has(filePath: string) {
|
||||
return this.watched.has(filePath)
|
||||
}
|
||||
|
||||
async reset() {
|
||||
await this.watcher.close()
|
||||
this.watched.clear()
|
||||
|
||||
this.watcher.on('add', (file: string) => this.onAdd(file))
|
||||
this.watcher.on('change', (file: string) => this.onChange(file))
|
||||
this.watcher.on('unlink', (file: string) => this.onUnlink(file))
|
||||
}
|
||||
|
||||
private onAdd(filePath: string) {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Watched ${filePath}.`)
|
||||
this.extension.eventBus.fire(eventbus.FileWatched, filePath)
|
||||
}
|
||||
|
||||
private onChange(filePath: string) {
|
||||
if (canContext(filePath)) {
|
||||
void this.cacher.refreshContext(filePath)
|
||||
}
|
||||
void this.extension.builder.buildOnFileChanged(filePath)
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Changed ${filePath}.`)
|
||||
this.extension.eventBus.fire(eventbus.FileChanged, filePath)
|
||||
}
|
||||
|
||||
private onUnlink(filePath: string) {
|
||||
this.watcher.unwatch(filePath)
|
||||
this.watched.delete(filePath)
|
||||
this.cacher.removeCachedContent(filePath)
|
||||
if (filePath === this.extension.manager.rootFile) {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Root deleted ${filePath}.`)
|
||||
this.extension.manager.rootFile = undefined
|
||||
void this.extension.manager.findRoot()
|
||||
} else {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Deleted ${filePath}.`)
|
||||
}
|
||||
this.extension.eventBus.fire(eventbus.FileRemoved, filePath)
|
||||
}
|
||||
|
||||
private registerOptionReload() {
|
||||
this.extension.context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.usePolling') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.interval') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.delay') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.pdf.delay')) {
|
||||
this.watcher.options.usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
this.watcher.options.interval = configuration.get('latex.watch.interval') as number
|
||||
this.watcher.options.awaitWriteFinish = {stabilityThreshold: configuration.get('latex.watch.delay') as number}
|
||||
}
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.files.ignore')) {
|
||||
this.watched.forEach(filePath => {
|
||||
if (!isExcluded(filePath)) {
|
||||
return
|
||||
}
|
||||
this.watcher.unwatch(filePath)
|
||||
this.watched.delete(filePath)
|
||||
this.cacher.removeCachedContent(filePath)
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Ignored ${filePath}.`)
|
||||
void this.extension.manager.findRoot()
|
||||
})
|
||||
}
|
||||
}))
|
||||
watchPdfFile(pdfFileUri: vscode.Uri) {
|
||||
this.pdfWatcher.watchPdfFile(pdfFileUri)
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,14 @@ export class BibWatcher {
|
||||
constructor(extension: Extension) {
|
||||
this.extension = extension
|
||||
this.bibWatcher = this.initiateBibwatcher()
|
||||
|
||||
this.extension.context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.usePolling') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.interval') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.delay')) {
|
||||
this.updateWatcherOptions()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
async dispose() {
|
||||
@ -18,27 +26,20 @@ export class BibWatcher {
|
||||
}
|
||||
|
||||
initiateBibwatcher() {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
const usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
const interval = configuration.get('latex.watch.interval') as number
|
||||
const delay = configuration.get('latex.watch.delay') as number
|
||||
const watcherOptions = {
|
||||
useFsEvents: false,
|
||||
usePolling,
|
||||
interval,
|
||||
binaryInterval: Math.max(interval, 1000),
|
||||
awaitWriteFinish: {stabilityThreshold: delay}
|
||||
}
|
||||
this.extension.logger.addLogMessage('Creating Bib file watcher.')
|
||||
this.extension.logger.addLogMessage(`watcherOptions: ${JSON.stringify(watcherOptions)}`)
|
||||
const bibWatcher = chokidar.watch([], watcherOptions)
|
||||
const bibWatcher = chokidar.watch([], {useFsEvents: false})
|
||||
this.updateWatcherOptions()
|
||||
bibWatcher.on('change', (file: string) => this.onWatchedBibChanged(file))
|
||||
bibWatcher.on('unlink', (file: string) => this.onWatchedBibDeleted(file))
|
||||
return bibWatcher
|
||||
}
|
||||
|
||||
updateWatcherOptions() {
|
||||
this.extension.manager.updateWatcherOptions(this.bibWatcher)
|
||||
private updateWatcherOptions() {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
this.bibWatcher.options.usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
this.bibWatcher.options.interval = configuration.get('latex.watch.interval') as number
|
||||
this.bibWatcher.options.binaryInterval = Math.max(configuration.get('latex.watch.interval') as number, 1000)
|
||||
this.bibWatcher.options.awaitWriteFinish = {stabilityThreshold: configuration.get('latex.watch.delay') as number}
|
||||
}
|
||||
|
||||
private async onWatchedBibChanged(file: string) {
|
@ -14,6 +14,14 @@ export class PdfWatcher {
|
||||
this.extension = extension
|
||||
this.pdfWatcher = this.initiatePdfWatcher()
|
||||
this.initiateVirtualUriWatcher()
|
||||
|
||||
this.extension.context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.usePolling') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.interval') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.pdf.delay')) {
|
||||
this.updateWatcherOptions()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
async dispose() {
|
||||
@ -25,27 +33,20 @@ export class PdfWatcher {
|
||||
}
|
||||
|
||||
private initiatePdfWatcher() {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
const usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
const interval = configuration.get('latex.watch.interval') as number
|
||||
const pdfDelay = configuration.get('latex.watch.pdf.delay') as number
|
||||
const pdfWatcherOptions = {
|
||||
useFsEvents: false,
|
||||
usePolling,
|
||||
interval,
|
||||
binaryInterval: Math.max(interval, 1000),
|
||||
awaitWriteFinish: {stabilityThreshold: pdfDelay}
|
||||
}
|
||||
this.extension.logger.addLogMessage('Creating PDF file watcher.')
|
||||
this.extension.logger.addLogMessage(`watcherOptions: ${JSON.stringify(pdfWatcherOptions)}`)
|
||||
const pdfWatcher = chokidar.watch([], pdfWatcherOptions)
|
||||
const pdfWatcher = chokidar.watch([], {useFsEvents: false})
|
||||
this.updateWatcherOptions()
|
||||
pdfWatcher.on('change', (file: string) => this.onWatchedPdfChanged(file))
|
||||
pdfWatcher.on('unlink', (file: string) => this.onWatchedPdfDeleted(file))
|
||||
return pdfWatcher
|
||||
}
|
||||
|
||||
updateWatcherOptions() {
|
||||
this.extension.manager.updateWatcherOptions(this.pdfWatcher, true)
|
||||
private updateWatcherOptions() {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
this.pdfWatcher.options.usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
this.pdfWatcher.options.interval = configuration.get('latex.watch.interval') as number
|
||||
this.pdfWatcher.options.binaryInterval = Math.max(configuration.get('latex.watch.interval') as number, 1000)
|
||||
this.pdfWatcher.options.awaitWriteFinish = {stabilityThreshold: configuration.get('latex.watch.pdf.delay')}
|
||||
}
|
||||
|
||||
private isWatchedVirtualUri(pdfFile: vscode.Uri): boolean {
|
102
src/components/cacherlib/texwatcher.ts
Normal file
102
src/components/cacherlib/texwatcher.ts
Normal file
@ -0,0 +1,102 @@
|
||||
import * as vscode from 'vscode'
|
||||
import * as chokidar from 'chokidar'
|
||||
|
||||
import { Extension } from '../../main'
|
||||
import * as eventbus from '../eventbus'
|
||||
import { Cacher } from '../cacher'
|
||||
import { canContext, isExcluded } from './cacherutils'
|
||||
|
||||
export class Watcher {
|
||||
readonly watcher: chokidar.FSWatcher
|
||||
readonly watched: Set<string> = new Set()
|
||||
|
||||
constructor(
|
||||
private readonly extension: Extension,
|
||||
private readonly cacher: Cacher
|
||||
) {
|
||||
this.watcher = chokidar.watch([], {useFsEvents: false})
|
||||
this.updateWatcherOptions()
|
||||
|
||||
this.watcher.on('add', (file: string) => this.onAdd(file))
|
||||
this.watcher.on('change', (file: string) => this.onChange(file))
|
||||
this.watcher.on('unlink', (file: string) => this.onUnlink(file))
|
||||
|
||||
this.registerOptionReload()
|
||||
}
|
||||
|
||||
private updateWatcherOptions() {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
this.watcher.options.usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
this.watcher.options.interval = configuration.get('latex.watch.interval') as number
|
||||
this.watcher.options.binaryInterval = Math.max(configuration.get('latex.watch.interval') as number, 1000)
|
||||
this.watcher.options.awaitWriteFinish = {stabilityThreshold: configuration.get('latex.watch.delay') as number}
|
||||
}
|
||||
|
||||
add(filePath: string) {
|
||||
this.watcher.add(filePath)
|
||||
this.watched.add(filePath)
|
||||
}
|
||||
|
||||
has(filePath: string) {
|
||||
return this.watched.has(filePath)
|
||||
}
|
||||
|
||||
async reset() {
|
||||
await this.watcher.close()
|
||||
this.watched.clear()
|
||||
|
||||
this.watcher.on('add', (file: string) => this.onAdd(file))
|
||||
this.watcher.on('change', (file: string) => this.onChange(file))
|
||||
this.watcher.on('unlink', (file: string) => this.onUnlink(file))
|
||||
}
|
||||
|
||||
private onAdd(filePath: string) {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Watched ${filePath}.`)
|
||||
this.extension.eventBus.fire(eventbus.FileWatched, filePath)
|
||||
}
|
||||
|
||||
private onChange(filePath: string) {
|
||||
if (canContext(filePath)) {
|
||||
void this.cacher.refreshContext(filePath)
|
||||
}
|
||||
void this.extension.builder.buildOnFileChanged(filePath)
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Changed ${filePath}.`)
|
||||
this.extension.eventBus.fire(eventbus.FileChanged, filePath)
|
||||
}
|
||||
|
||||
private onUnlink(filePath: string) {
|
||||
this.watcher.unwatch(filePath)
|
||||
this.watched.delete(filePath)
|
||||
this.cacher.removeCachedContent(filePath)
|
||||
if (filePath === this.extension.manager.rootFile) {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Root deleted ${filePath}.`)
|
||||
this.extension.manager.rootFile = undefined
|
||||
void this.extension.manager.findRoot()
|
||||
} else {
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Deleted ${filePath}.`)
|
||||
}
|
||||
this.extension.eventBus.fire(eventbus.FileRemoved, filePath)
|
||||
}
|
||||
|
||||
private registerOptionReload() {
|
||||
this.extension.context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.usePolling') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.interval') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.delay')) {
|
||||
this.updateWatcherOptions()
|
||||
}
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.files.ignore')) {
|
||||
this.watched.forEach(filePath => {
|
||||
if (!isExcluded(filePath)) {
|
||||
return
|
||||
}
|
||||
this.watcher.unwatch(filePath)
|
||||
this.watched.delete(filePath)
|
||||
this.cacher.removeCachedContent(filePath)
|
||||
this.extension.logger.addLogMessage(`[Cacher][Watcher] Ignored ${filePath}.`)
|
||||
void this.extension.manager.findRoot()
|
||||
})
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
@ -3,15 +3,12 @@ import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
import * as tmp from 'tmp'
|
||||
import * as chokidar from 'chokidar'
|
||||
import * as utils from '../utils/utils'
|
||||
// import {InputFileRegExp} from '../utils/inputfilepath'
|
||||
|
||||
import type {Extension} from '../main'
|
||||
import * as eventbus from './eventbus'
|
||||
|
||||
import {PdfWatcher} from './managerlib/pdfwatcher'
|
||||
import {BibWatcher} from './managerlib/bibwatcher'
|
||||
import {FinderUtils} from './managerlib/finderutils'
|
||||
import {IntellisenseWatcher} from './managerlib/intellisensewatcher'
|
||||
|
||||
@ -30,8 +27,6 @@ export class Manager {
|
||||
readonly tmpDir: string
|
||||
|
||||
private readonly extension: Extension
|
||||
private readonly pdfWatcher: PdfWatcher
|
||||
readonly bibWatcher: BibWatcher
|
||||
readonly intellisenseWatcher: IntellisenseWatcher
|
||||
private readonly finderUtils: FinderUtils
|
||||
private readonly rsweaveExt: string[] = ['.rnw', '.Rnw', '.rtex', '.Rtex', '.snw', '.Snw']
|
||||
@ -39,23 +34,10 @@ export class Manager {
|
||||
|
||||
constructor(extension: Extension) {
|
||||
this.extension = extension
|
||||
this.pdfWatcher = new PdfWatcher(extension)
|
||||
this.bibWatcher = new BibWatcher(extension)
|
||||
this.intellisenseWatcher = new IntellisenseWatcher()
|
||||
this.finderUtils = new FinderUtils(extension)
|
||||
this.registerSetEnvVar()
|
||||
|
||||
this.extension.context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
|
||||
if (e.affectsConfiguration('latex-workshop.latex.watch.usePolling') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.interval') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.delay') ||
|
||||
e.affectsConfiguration('latex-workshop.latex.watch.pdf.delay')) {
|
||||
// this.updateWatcherOptions(this.fileWatcher)
|
||||
this.bibWatcher.updateWatcherOptions()
|
||||
this.pdfWatcher.updateWatcherOptions()
|
||||
}
|
||||
}))
|
||||
|
||||
// Create temp folder
|
||||
try {
|
||||
this.tmpDir = tmp.dirSync({unsafeCleanup: true}).name.split(path.sep).join('/')
|
||||
@ -72,19 +54,6 @@ export class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
updateWatcherOptions(watcher: chokidar.FSWatcher, pdf = false) {
|
||||
const configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
watcher.options.usePolling = configuration.get('latex.watch.usePolling') as boolean
|
||||
watcher.options.interval = configuration.get('latex.watch.interval') as number
|
||||
watcher.options.awaitWriteFinish = {
|
||||
stabilityThreshold: pdf ? configuration.get('latex.watch.pdf.delay') : configuration.get('latex.watch.delay') as number
|
||||
}
|
||||
}
|
||||
|
||||
async dispose() {
|
||||
await this.pdfWatcher.dispose()
|
||||
await this.bibWatcher.dispose()
|
||||
}
|
||||
/**
|
||||
* Returns the output directory developed according to the input tex path
|
||||
* and 'latex.outDir' config. If `texPath` is `undefined`, the default root
|
||||
@ -223,12 +192,6 @@ export class Manager {
|
||||
return path.resolve(path.dirname(texPath), outDir, path.basename(`${texPath.substring(0, texPath.lastIndexOf('.'))}.pdf`))
|
||||
}
|
||||
|
||||
ignorePdfFile(rootFile: string) {
|
||||
const pdfFilePath = this.tex2pdf(rootFile)
|
||||
const pdfFileUri = vscode.Uri.file(pdfFilePath)
|
||||
this.pdfWatcher.ignorePdfFile(pdfFileUri)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the language of `id` is one of supported languages.
|
||||
*
|
||||
@ -407,10 +370,6 @@ export class Manager {
|
||||
return this.intellisenseWatcher.onDidUpdateIntellisense(cb)
|
||||
}
|
||||
|
||||
watchPdfFile(pdfFileUri: vscode.Uri) {
|
||||
this.pdfWatcher.watchPdfFile(pdfFileUri)
|
||||
}
|
||||
|
||||
private registerSetEnvVar() {
|
||||
this.setEnvVar()
|
||||
const configName = 'latex-workshop.docker.image.latex'
|
||||
|
@ -111,7 +111,7 @@ export class Viewer {
|
||||
}
|
||||
const pdfFileUri = this.tex2pdf(sourceFile)
|
||||
this.createClientSet(pdfFileUri)
|
||||
this.extension.manager.watchPdfFile(pdfFileUri)
|
||||
this.extension.cacher.watchPdfFile(pdfFileUri)
|
||||
try {
|
||||
this.extension.logger.addLogMessage(`Serving PDF file at ${url}`)
|
||||
await vscode.env.openExternal(vscode.Uri.parse(url, true))
|
||||
|
@ -58,7 +58,7 @@ export class PdfViewerManagerService {
|
||||
|
||||
initiatePdfViewerPanel(pdfPanel: PdfViewerPanel): PdfViewerPanel | undefined {
|
||||
const pdfFileUri = pdfPanel.pdfFileUri
|
||||
this.extension.manager.watchPdfFile(pdfFileUri)
|
||||
this.extension.cacher.watchPdfFile(pdfFileUri)
|
||||
this.createClientSet(pdfFileUri)
|
||||
const panelSet = this.getPanelSet(pdfFileUri)
|
||||
if (!panelSet) {
|
||||
|
@ -415,7 +415,6 @@ export class Extension {
|
||||
|
||||
async dispose() {
|
||||
await this.cacher.dispose()
|
||||
await this.manager.dispose()
|
||||
this.server.dispose()
|
||||
await this.pegParser.dispose()
|
||||
await this.mathPreview.dispose()
|
||||
|
Loading…
Reference in New Issue
Block a user