mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2024-10-04 07:07:54 +03:00
(#39) Linting feature
This commit is contained in:
parent
7c45c5fcf7
commit
f167e27a57
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [1.1.0] - 2017-03-27
|
||||
### Added
|
||||
- (#39) LaTeX linting with `chktex`.
|
||||
|
||||
## [1.0.2] - 2017-03-26
|
||||
### Fixed
|
||||
- (#38) Cope with typical language ids.
|
||||
|
@ -3,7 +3,7 @@
|
||||
"displayName": "LaTeX Workshop",
|
||||
"description": "Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.",
|
||||
"icon": "icon.png",
|
||||
"version": "1.0.2",
|
||||
"version": "1.1.0",
|
||||
"publisher": "James-Yu",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/James-Yu/LaTeX-Workshop",
|
||||
@ -154,6 +154,11 @@
|
||||
"default": true,
|
||||
"description": "Build LaTeX after saving LaTeX source file.\nThis property defines whether LaTeX Workshop will execute the LaTeX toolchain command(s) to build the project after new LaTeX contents are saved."
|
||||
},
|
||||
"latex-workshop.linter": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Lint LaTeX when no document changes for a defined period of time."
|
||||
},
|
||||
"latex-workshop.linter_command": {
|
||||
"type": "string",
|
||||
"default": "chktex -q -v0 %DOC%",
|
||||
|
11
src/main.ts
11
src/main.ts
@ -37,10 +37,13 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(vscode.workspace.onDidChangeTextDocument((e: vscode.TextDocumentChangeEvent) => {
|
||||
if (extension.manager.isTex(e.document.fileName)) {
|
||||
let configuration = vscode.workspace.getConfiguration('latex-workshop')
|
||||
let interval = configuration.get('linter_interval') as number
|
||||
if (extension.linter.linterTimeout)
|
||||
clearTimeout(extension.linter.linterTimeout)
|
||||
extension.linter.linterTimeout = setTimeout(() => extension.linter.lint(), interval)
|
||||
let linter = configuration.get('linter') as boolean
|
||||
if (linter) {
|
||||
let interval = configuration.get('linter_interval') as number
|
||||
if (extension.linter.linterTimeout)
|
||||
clearTimeout(extension.linter.linterTimeout)
|
||||
extension.linter.linterTimeout = setTimeout(() => extension.linter.lint(), interval)
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user