Skip to content

Linters

Takashi Tamura edited this page Apr 30, 2021 · 18 revisions
Clone this wiki locally

Linting

Duplicate labels

Duplicate labels are highlighted when latex-workshop.check.duplicatedLabels.enabled is set to true. The computation of the duplicates is based on the data collected for intellisense, so we cannot update the duplicates more often than intellisense. When intellisense.update.aggressive.enabled is set to false, duplicates are updated on file save. When intellisense.update.aggressive.enabled is set to true, duplicates are updated after stopped typing for longer than latex-workshop.intellisense.update.delay.

latex-workshop.check.duplicatedLabels.enabled

Enable checking for duplicated labels.

A new check is triggered every time the intellisense data is updated, see intellisense.update.aggressive.enabled .

type default value
boolean true

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.

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
latex-workshop.chktex.convertOutput.column.enabled Enable converting ChkTeX outputs true boolean
latex-workshop.chktex.convertOutput.column.chktexrcTabSize TabSize number -1 number

Configuration variables

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.active and latex-workshop.chktex.args.root to form a complete ChkTeX command.

"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

latex-workshop.chktex.convertOutput.column.enabled

Enable converting ChkTeX outputs' column numbers for non-ASCII characters.

type default value
boolean true

latex-workshop.chktex.convertOutput.column.chktexrcTabSize

Write the TabSize number from .chktexrc. The default value -1 means that LaTeX Workshop will try to find .chktexrc and to read the value from it.

type default value
number -1