mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2024-10-04 23:27:20 +03:00
Only count words in the current document on save
This commit is contained in:
parent
4e7bbe1fc3
commit
0d2ddad1b5
@ -1581,7 +1581,7 @@
|
||||
"never"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"Count words in the LaTeX documents of the entire project from the root file",
|
||||
"Count words in the current document",
|
||||
"Never automatically call texcount"
|
||||
],
|
||||
"default": "never",
|
||||
|
@ -68,7 +68,7 @@ export class Counter {
|
||||
}
|
||||
}
|
||||
|
||||
async countOnSaveIfEnabled(file: string) {
|
||||
countOnSaveIfEnabled(file: string) {
|
||||
if (!this.autoRunEnabled) {
|
||||
return
|
||||
}
|
||||
@ -79,14 +79,7 @@ export class Counter {
|
||||
this.extension.logger.addLogMessage(`Auto texcount started on saving file: ${file}`)
|
||||
this.disableCountAfterSave = true
|
||||
setTimeout(() => this.disableCountAfterSave = false, this.autoRunInterval)
|
||||
if (this.extension.manager.rootFile === undefined) {
|
||||
await this.extension.manager.findRoot()
|
||||
}
|
||||
if (this.extension.manager.rootFile === undefined) {
|
||||
this.extension.logger.addLogMessage('Cannot find root file')
|
||||
return
|
||||
}
|
||||
void this.runTeXCount(this.extension.manager.rootFile).then(() => {
|
||||
void this.runTeXCount(file).then(() => {
|
||||
this.updateWordCount()
|
||||
})
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ export function activate(context: vscode.ExtensionContext): ReturnType<typeof ge
|
||||
void extension.manager.buildOnSave(e.fileName)
|
||||
}
|
||||
}
|
||||
void extension.counter.countOnSaveIfEnabled(e.fileName)
|
||||
extension.counter.countOnSaveIfEnabled(e.fileName)
|
||||
}
|
||||
}))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user