Editor Integration (t-linter)¶
t-linter is a linter, formatter, and LSP server for Python template strings (PEP 750 t-strings). It uses the same Rust backends (tstring-json, tstring-toml, tstring-yaml) as this project for check and format operations.
Installation¶
Or with uv:
CLI usage¶
Check templates for errors¶
Validate t-string templates in your Python files:
Output format options:
t-linter check file.py --format human # default, human-readable
t-linter check file.py --format json # machine-readable JSON
t-linter check file.py --format github # GitHub Actions annotations
Use --error-on-issues to fail CI when problems are found:
Format templates¶
Canonical formatting for JSON, YAML, and TOML template literals:
Dry-run to see what would change without modifying files:
Read from stdin:
LSP server¶
Start the built-in LSP server for real-time editor diagnostics and formatting:
The LSP provides:
- Diagnostics — syntax and semantic errors reported inline as you type
- Formatting — format-on-save or format-on-demand via your editor's formatting command
VSCode integration¶
-
Install the binary:
-
Install the t-linter extension from the VSCode marketplace.
-
Recommended: set
"python.languageServer": "None"in VSCode settings to avoid conflicts with other Python language servers. -
Optionally configure
t-linter.serverPathin settings if the binary is not on yourPATH.
Other editors¶
Any editor that supports the Language Server Protocol can use t-linter lsp. Configure your editor to start t-linter lsp as the language server for Python files.
Configuration¶
Configure t-linter via pyproject.toml:
How it works with tstring-structured-data¶
t-linter and tstring-structured-data share the same Rust parsing and formatting backends:
- tstring-structured-data is the runtime library —
render_data()andrender_text()parse and render templates at runtime - t-linter is the developer tooling —
checkvalidates templates andformatcanonicalizes them at development time
For JSON, YAML, and TOML templates, t-linter uses:
- Tree-sitter for fast syntax highlighting (low-latency, no full parse)
- Rust backends (
tstring-json,tstring-yaml,tstring-toml) for strictcheckandformatoperations