Delphi 6 Live Linter
An all-in-one Visual Studio Code extension for Delphi 6 Object Pascal ( It combines a fast, cross-platform real-time linter (30 rules
Table of Contents
Quick Start
Integrated UI & Sidebar
Real-Time Linter Rules (
|
| Code | Severity | Description | Quick Fix |
|---|---|---|---|
D6001 |
Error | Unterminated string literals ('...') or block comments ({...}, (*...*)) |
— |
D6002 |
Error | Missing or invalid unit structure (unit/program/library, interface, implementation, end.) |
— |
D6003 |
Error | Unbalanced blocks and delimiters (begin..end, repeat..until, try, case, record, class, (), []) |
— |
D6004 |
Error | try block without except or finally, or orphan except/finally |
— |
D6005 |
Error | Missing semicolon (;) after unit header, uses clause, var declarations, or statements inside begin..end |
Yes |
D6006 |
Error | Illegal semicolon (;) before else in if..then..else (permitted in case..of) |
Yes |
D6007 |
Error | Malformed uses clause (empty or trailing comma) |
— |
D6008 |
Error | Assignment vs. comparison mismatch (:= in if/while/until, or x = 5; as a standalone statement) |
Yes |
D6009 |
Error | Inline var declarations inside begin..end (unsupported in Delphi 6) |
— |
D6010 |
Warning | Unit name does not match the .pas filename |
Yes |
D6011 |
Warning | Duplicate unit name in the same uses clause |
— |
D6012 |
Warning | Unused local variable declared in a routine var section |
— |
D6013 |
Warning | Empty except block that silently swallows exceptions |
— |
D6014 |
Warning | function body that does not assign Result (or the function name) |
— |
D6015 |
Error | Missing then after if, do after while/for, or to/downto in for loops |
— |
D6016 |
Error | Duplicate local variable declaration in the same var block |
— |
D6017 |
Warning | Routine declared in interface with no matching implementation in implementation |
Yes |
D6018 |
Error | Post-Delphi 6 syntax incompatible with Delphi 6 (for..in, strict private/protected, class/record helper) |
— |
D6019 |
Warning | Unreachable statement after unconditional Exit;, Break;, Continue;, or raise |
— |
D6020 |
Error | Unclosed {$IFDEF}/{$IFNDEF} or orphan {$ELSE}/{$ENDIF} directives |
— |
D6021 |
Error | Signature mismatch between interface and implementation (parameters, return type, or procedure/function) |
— |
D6022 |
Warning | Assignment to an undeclared identifier in standalone routines (offline check) | — |
D6023 |
Warning | Possible memory leak: unowned local object created with TClass.Create never freed or freed outside try..finally |
— |
D6024 |
Hint | Redundant boolean comparison (= True / = False) in condition |
Yes |
D6025 |
Hint | with statement usage suggestion (can hide scope ambiguities) |
— |
D6026 |
Hint | Overly long routine (>150 lines) refactoring suggestion | — |
D6027 |
Hint | Suggests FreeAndNil(Obj) instead of Obj.Free inside finally blocks |
Yes |
D6028 |
Warning | Possible use-after-free / dangling pointer: local object accessed after .Free or FreeAndNil |
— |
D6029 |
Error | Event handler referenced in sibling .dfm (OnClick = ...) is missing from the .pas form class |
— |
D6030 |
Warning | Component declared in sibling .dfm is not declared in the .pas form class |
— |
Noise Control & Incremental Git Diff Mode
- 3-Category Severity Separation: Distinct red underlines (Errors), amber underlines (Warnings), and dotted blue underlines (Hints/Improvements), separate status bar counters (
XE YW ZH), and quick severity filtering (All,Errors + Warnings,Errors Only). - Changed Lines Only (Git Diff Mode): Set
delphi6Validator.analysisScopeto"changedOnly"(or click the Toggle Diff Mode button) to show warnings and hints only on newly added/modified lines compared againstHEADwhile keeping critical syntax errors visible. - Granular Silencing:
- Per-line:
// delphi6-lint-disable-next-line D6012or// delphi6-lint-disable-line D6006 - Per-file:
// delphi6-lint-disable-fileor// delphi6-lint-disable-file D6012, D6023(also supports{ ... }comments) - Project/folder settings:
disabledRules,ruleOverrides, andexcludePatterns.
- Per-line:
Navigation, IntelliSense & Formatting
- Syntax Highlighting: Built-in Delphi 6 Object Pascal TextMate grammar (
syntaxes/delphi6.tmLanguage.json) with auto-closing pairs and{$REGION}/{$ENDREGION}folding. - Autocomplete & Signature Help: Context-aware completions for local variables, parameters, unit declarations,
Self./Obj.class members, Delphi 6 BCL types (TStringList,TMemoryStream,TForm,TQuery,TIniFile, etc.), and live parameter hints while typingCall(. - Hover Information: Shows variable types, routine signatures, preceding doc comments, and Delphi 6 RTL built-in descriptions.
- Go to Definition (
F12), Switchinterface/implementation(Ctrl+Shift+Up/Down), Find All References (Shift+F12), and Safe Rename (F2): Token-aware across the file and workspaceusesunits without touching strings or comments. - Format Document & Format Selection: Automatic block indentation and configurable keyword casing (
lower,upper, orpreserve), preserving strings, comments, directives, andasm..endblocks. - Code Snippets:
unit,tryf,trye,class,proc,func,fori,foridown,tlist,case,ifdef, andregion.
Project Building, Libraries & .dfm Support
- Build & Run (
.dpr -> .exe,F9) & Project Groups (.bpg): Compiles.dprprojects or multi-target.bpggroups in order usingdcc32.exe(orfpc), writes real.exeand.dcuoutputs toOutputDir/UnitOutputDir, and launches the.exenatively in Windows. - Smart Library Discovery:
- Reads project
.cfgand.doffiles (expanding$(DELPHI)automatically fromdcc32.exe). - Reads Delphi 6's global Library Search Path from the Windows Registry (
HKCU\Software\Borland\Delphi\6.0\Library). - Recursively scans
delphi6Validator.libraryRootPathsfor.pas/.dcu/.incfolders and offers one-click"Add Missing Paths & Rebuild"when a unit is missing.
- Reads project
- Binary
.dfmSupport (convert.exe): Automatically converts binary.dfmfiles via Delphi 6'sconvert.exefor.dfm<->.pascross-checking (D6029/D6030) and providesPreview Binary .dfm as Text. - Quality & Team Tools: Dependency & Indy conflict audit, Pre-Release Validation Gate,
.map/ EurekaLog / MadExcept / JclDebug stack trace analyzer, Markdown API doc generator, DUnit & FastMM4 scaffolds, and JSON/CSV/TXT report export.
Native Delphi 6 Debugger (Windows, F5)
Debug 32-bit Delphi 6 .exe binaries directly inside Visual Studio Code via the built-in Debug Adapter (type: "delphi6"):
- Zero External Dependencies: Compiles a lightweight native 32-bit Win32 Debug API host automatically on Windows using the built-in
.NET Framework 4.0x86csc.exe. - Auto-Build with TD32 +
.mapSymbols: Compiles your.dprwith-V -$D+ -$L+ -GDand reads PE32ImageBase/.textRVA directly from the.exe. - Named Local Variables (TD32
FB09/FB0A): Parses Borland TD32 debug tables from the.exeor.tdsfile to display real local variable & parameter names in the Locals scope and evaluate them by name in Watch, Debug Console, and Editor Hover. - Breakpoints, Stepping & Exceptions:
INT 3 (0xCC)breakpoints snapped to executable lines, Continue (F5), Step Over (F10) across branches, Step Into (F11), Step Out (Shift+F11),EBPCall Stack mapped to.paslines,OutputDebugStringcapture, and Delphi 6 exception decoding (0x0EEDFADEVMT class name +Exception.Message, plus0xC0000005Access Violations).
Example .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "delphi6",
"request": "launch",
"name": "Debug Delphi 6 App",
"program": "${workspaceFolder}/MyProject.dpr",
"buildBeforeLaunch": true,
"breakOnDelphiExceptions": true
}
]
}
Keyboard Shortcuts
| Shortcut (Windows / Linux) | macOS | Action |
|---|---|---|
F9 |
F9 |
Build & Run Project (.dpr -> .exe) |
F5 |
F5 |
Launch & Debug Delphi 6 Project |
Ctrl+Shift+Up / Down |
Cmd+Shift+Up / Down |
Switch Between interface and implementation |
F12 |
F12 |
Go to Definition |
Shift+F12 |
Shift+F12 |
Find All References |
F2 |
F2 |
Safe Rename Symbol |
Ctrl+Shift+O |
Cmd+Shift+O |
Go to Symbol / Outline |
Commands
Delphi 6: Open Control CenterDelphi 6: Build Project (.dpr -> .exe)Delphi 6: Rebuild All (.dpr -> .exe, -B)Delphi 6: Build & Run Project (.exe)Delphi 6: Build Project Group (.bpg)Delphi 6: Validate Current .pas FileDelphi 6: Validate All .pas Files in WorkspaceDelphi 6: Run Compiler Check (dcc32 / fpc)Delphi 6: Switch Between Interface and ImplementationDelphi 6: Toggle Analysis Scope (Changed Lines Only / Full File)Delphi 6: Filter Diagnostics by SeverityDelphi 6: Discover Library Search Paths RecursivelyDelphi 6: Audit Project Dependencies & Conflicts (.pas/.dcu/Indy)Delphi 6: Run Pre-Release Validation GateDelphi 6: Validate .dfm <-> .pas Components & EventsDelphi 6: Preview Binary .dfm as Text (convert.exe)Delphi 6: Analyze Stack Trace / .map Crash AddressDelphi 6: Export Diagnostics Report (JSON / CSV / TXT)Delphi 6: Generate Markdown Documentation for Current .pasDelphi 6: Generate DUnit Test Unit for Current .pasDelphi 6: Generate FastMM4 Memory Leak Setup GuideDelphi 6: Clear DiagnosticsDelphi 6: Show Output Log
Extension Settings
{
"delphi6Validator.enableRealtimeLint": true,
"delphi6Validator.debounceMs": 250,
"delphi6Validator.maxDiagnostics": 500,
"delphi6Validator.analysisScope": "all",
"delphi6Validator.alwaysShowErrorsInDiffMode": true,
"delphi6Validator.severityFilter": "all",
"delphi6Validator.disabledRules": [],
"delphi6Validator.excludePatterns": ["**/*.dfm", "**/*.xfm", "**/*.fmx", "**/__history/**", "**/__recovery/**"],
"delphi6Validator.ruleOverrides": [],
"delphi6Validator.defines": ["WIN32", "MSWINDOWS", "VER140"],
"delphi6Validator.enableCompilerOnSave": true,
"delphi6Validator.autoReadProjectConfig": true,
"delphi6Validator.readWindowsRegistryLibraryPath": true,
"delphi6Validator.enableDfmCrossCheck": true,
"delphi6Validator.compilerType": "auto",
"delphi6Validator.compilerPath": "",
"delphi6Validator.projectDprPath": "",
"delphi6Validator.exeOutputDir": "",
"delphi6Validator.unitOutputDir": "",
"delphi6Validator.searchPaths": [],
"delphi6Validator.libraryRootPaths": [],
"delphi6Validator.extraArgs": [],
"delphi6Validator.compilerTimeoutMs": 15000,
"delphi6Validator.format.indentSize": 2,
"delphi6Validator.format.keywordCase": "lower"
}
Performance on Large Units
Engineered specifically for legacy 10,000–20,000+ line Delphi 6 forms and data modules:
- Shared bounded LRU token cache across validation, Outline, Go to Definition, IntelliSense, Hover, and formatting.
- Adaptive debouncing (5k+ lines and 15k+ lines), document-version deduplication, and
maxDiagnosticsflood protection. - Verified benchmarks: 20,000+ line units validate in ~35–65 ms; autocomplete, hover, references, and doc generation run in < 40 ms combined.
License
MIT
