Lightweight VS Code extension that validates file paths referenced in TUFLOW control files and surfaces missing references as diagnostics in the Problems panel.
- Validates input-file paths in recognised TUFLOW commands and reports missing files in the Problems view. Output locations, runtime conditions, variable declarations and unknown commands are not treated as input-file references.
- Resolves relative paths from the current file, except paths in nested TRD files which resolve from their source TCF directory; honors
|-separated lists and ignores GeoPackage selectors after>>. - Skips tokens and macros that remain unresolved (any
<<...>>sequence) while still analyzing other paths. - Recursively checks referenced control files and summarizes issues discovered in nested dependencies.
- Warns when scenario/event tokens
<<~s1~>>-<<~s9~>>or<<~e1~>>-<<~e9~>>appear in a value but are missing from the filename. - When a versioned TCF/TGC/TBC/ECF is the latest in its folder, referenced files with numeric versions (e.g.,
v07,011,Model12) are checked for newer alternatives or ambiguous updates. - Validates
Set Variable Versiontokens against the current filename and surfaces whether the token matches (info) or is missing (warning). - Validates
If Event ==/If Scenario ==,Define Event, andStart 1D/2D Domainblocks with matchingEndstatements (case-insensitive). - Configurable minimum diagnostic severity (default:
hint) and focus on path validation rather than a full TUFLOW grammar. - Quick Fixes help add ignore comments for a specific line or the entire file when issues should be suppressed, and offer to update versioned references when a
Set Variable Versionheader is present in a.tcf.
.tcf.tgc.tbc.trd.tef.ecf.qcf.tesf.tscf.trfc.toc
- Open Extensions (Ctrl+Shift+X).
- Search for "TUFLOW Path Validator".
- Click Install.
- Download the
.vsixfrom a release. - Go to Extensions → ... → Install from VSIX.
Open any supported control file and diagnostics appear automatically as you edit. Example:
Read GIS Z Shape == gis/terrain.gpkg >> contours
Read GIS BC == missing/bc_01.shp | bc/valid_02.shp
Activation note: the extension activates only when a workspace contains at least one supported control file.
Use comments to suppress diagnostics when needed.
- Ignore a specific line: append
! tpv-ignore.Read GIS Z Shape == missing_file.shp ! tpv-ignore - Ignore an entire file: add
! tpv-ignore-fileanywhere in the file (commonly at the top).! tpv-ignore-file Read GIS Z Shape == missing_file.shp
Click a diagnostic to see Quick Fixes that automatically insert ! tpv-ignore or ! tpv-ignore-file comments so you do not need to edit the file manually.
- Update to latest version (TUFLOW): When a newer file in the same recognised series exists, the Quick Fix replaces the referenced filename with the verified target, preserving the directory. No update is offered if the target cannot be verified.
tuflowValidator.diagnosticLevel:error,warning,info,hint(default), ornone.tuflowValidator.enableLatestVersionChecks: Enable latest-version checks for versioned filenames (default:true).tuflowValidator.enableIfStatementChecks: ValidateIf Event ==/If Scenario ==,Define Event, andStart 1D/2D Domainblocks with matchingEndstatements (default:true).tuflowValidator.enableIfStatementFormatting: FormatIf/Else/End Ifindentation with tab-based nesting (default:false).
When enabled, Format Document aligns If Event == / If Scenario ==, Define Event, and Start 1D/2D Domain blocks so that:
- Lines inside a block are indented by one tab per nesting level.
Else,Else If, andEnd Ifalign with the matchingIf. Recognized forms areIf Event ==,If Scenario ==,Else If Event ==,Else If Scenario ==,End If,Define Event,End Define,Start 1D Domain,End 1D Domain,Start 2D Domain, andEnd 2D Domain.
Latest-version checks run only for the "latest" TCFs in the folder of the currently open TCF. The extension does not scan the full workspace for TCFs. A TCF is considered latest when it is either:
- The highest-numbered file in a versioned series (files containing a number contribute to a versioned series).
- An unversioned file (no number) that stands on its own.
Multiple latest TCFs can coexist in a folder when different series or unversioned files are present.
Example:
file.tcf # latest (no version token)
file_01.tcf
file02.tcf # latest (highest in its series)
king05.tcf
king08.tcf # latest (highest in its series)
- Macros and variables like
<<OutputRoot>>or<<~s1~>>are ignored if they cannot be resolved. - This extension does not implement a full TUFLOW grammar; it focuses on file-path validation.
- Unrecognised commands are not assumed to consume files. Input-path validation is intentionally conservative to avoid false errors.
- It does not validate dataset contents, layer names, or runtime options.
npm run compile
npm run test:container
npm run package:vsix