TcView is a code-centric TwinCAT companion for VS Code.
It is designed around:
- editing TwinCAT PLC source in ST form
- project browsing and navigation
- metadata-backed library recognition
- quick solution build support
It is not designed to replace TwinCAT XAE runtime, configuration, or device-engineering workflows.
Primary implementation lives in the TypeScript extension.
Key files:
- extension.ts
- tcViewFileExplorerProvider.ts
- tcViewWebviewExplorerProvider.ts
- tcViewFileSystemProvider.ts
- tcViewProjectAnalyzer.ts
- iecStLanguageFeatures.ts
Responsibilities:
- workspace/root detection
- tree model population and webview explorer state
- virtual ST file handling
- save-back to XML
- diagnostics, completion, hover, rename, references, folding, semantic tokens
- local project and library metadata analysis
- library viewer webview generation
- solution build orchestration
TcView does not edit TwinCAT XML directly in the visible editor surface.
Flow:
- XML source is converted into ST text
- ST is edited in a virtual document
- save writes the ST back into the original XML structure
Key files:
The analyzer builds the symbol/type view used by diagnostics, completion, hover, and library inspection.
Sources merged by the analyzer:
- local TwinCAT source files
- project
.plcprojreferences - project
.tmc - installed Managed Libraries metadata
- built-in catalog metadata
- global/workspace metadata files
Key file:
The backend is not required for normal editing.
Current backend usage is limited to TwinCAT Automation Interface operations:
- install library project
- add library reference to project
- remove library reference from project
Key files:
Current packaging note:
- backend source exists in the repo
- Windows alpha VSIX packaging includes the release backend output
- backend commands use the bundled backend by default
twincat.backend.executablePathexists as an override for advanced/custom backend scenarios
TcView intentionally avoids treating arbitrary folders as TwinCAT roots.
Valid roots:
- solution root:
- contains
.slnand.tsprojor.tspproj
- contains
- standalone PLC root:
- contains
.plcproj
- contains
Anything else remains a normal VS Code folder, with TcView inactive or in welcome state.
The Open TwinCAT Solution command accepts .sln only.
TcView groups detected TwinCAT content into:
SYSTEMPLCI/O
The current TcView sidebar Explorer is a webview-backed tree that renders state provided by the extension host.
In practice:
TwinCATFileExplorerProviderremains the source of truth for structure, file metadata, and aggregated diagnosticsTwinCATWebviewExplorerProviderhandles rendering, expansion state, selection state, and lightweight UI interactions
Rules:
- solution-like roots show all three groups, even when empty
- standalone PLC roots show only
PLC - hidden/internal folders starting with
.or_are excluded
Each PLC project folder can expose:
- source folders/files
References
References can include:
- explicit
.plcprojplaceholder references - synthetic system-global libraries such as
Tc3_GlobalTypesfamily entries - extension-host-derived diagnostic and SCM state that is pushed into the webview for rendering
TcView treats library knowledge as layered provenance, not a single binary "known/unknown" state.
Important provenance categories:
tmcmanaged_librariesbuilt_inusersystem_global
This is important because:
.tmcis closest to project truth- built-in/user metadata is useful earlier, but not compiler-validated
- system-global libraries like
Tc3_GlobalTypesbehave differently from ordinary references
Current build support is intentionally narrow:
- build active TwinCAT solution with MSBuild
There is no current attempt to reproduce full XAE deploy/runtime workflows.
That boundary is deliberate.
TcView.sln exists to support backend development in Visual Studio.
It is not the main build entrypoint for the VS Code extension itself.
Extension build/test remains:
npm run compilenpm test