Skip to content

Linters

Trevor Gunn edited this page Aug 28, 2019 · 9 revisions

Linting

ChkTeX

The ChkTeX utility is a LaTeX semantic checker. Once installed, and the relevant setting enabled it is automatically run on any open TeX documents. It output is parsed by the extension and displayed in the Problems panel.

Auto load of .chktexrc configuration files is performed in the following order

  1. Manually configured -l setting in chktex.args
  2. The .chktexrc file (if exists) in the same folder as the main LaTeX file
  3. The .chktexrc file (if exists) at the project root folder.

Relevant Settings

Overview

Setting key Description Default Type
latex-workshop.chktex.args.active Arguments to be passed to ChkTeX for current file ["-wall", "-n22", "-n30", "-e16", "-q"] array of strings
latex-workshop.chktex.args.root Arguments to be passed to ChkTeX for entire project ["-wall", "-n22", "-n30", "-e16", "-q"] array of strings
latex-workshop.chktex.enabled Enable LaTeX linting with ChkTeX false boolean
latex-workshop.chktex.path Location of ChkTeX executable "chktex" string
latex-workshop.chktex.run When to run ChkTeX (on file save or while typing) "onSave" enum

Details

latex-workshop.chktex.args.active

Linter arguments to check LaTeX syntax of the current file state in real time with ChkTeX.

Arguments must be in separate strings in the array. Additional arguments, i.e., -I0 -f%f:%l:%c:%d:%k:%n:%m\n will be appended when constructing the command. Current file contents will be piped to the command through stdin.

type default value
array of strings ["-wall", "-n22", "-n30", "-e16", "-q"]

latex-workshop.chktex.args.root

Linter arguments to check LaTeX syntax of the entire project from the root file with ChkTeX.

Arguments must be in separate strings in the array. Additional arguments, i.e., -f%f:%l:%c:%d:%k:%n:%m\n %DOC% will be appended when constructing the command.

type default value
array of strings ["-wall", "-n22", "-n30", "-e16", "-q"]

latex-workshop.chktex.enabled

Enable linting LaTeX with ChkTeX.

The active document will be linted when no document changes for a defined period of time.

The full project will be linted from the root on file save.

type default value
boolean false

latex-workshop.chktex.path

Define the location of ChkTeX executive file.

This command will be joint with latex-workshop.chktex.args.* and required arguments to form a complete command of ChkTeX.

"latex-workshop.chktex.path": "chktex"

type default value
string "chktex"

latex-workshop.chktex.run

When LaTeX should be linted by ChkTeX. If set to onSave, the whole LaTeX project will be linted upon saving. If set to onType, the active document will be linted when input is stopped for a period of time defined in latex-workshop.chktex.delay, in addition to the behavior of onSave.

type default value
enum "onSave"

latex-workshop.chktex.delay

When latex-workshop.chktex.run is set to onType, defines the delay in milliseconds for chktex to wait after stopped typing.

type default value
number 500
You can’t perform that action at this time.