PKGShell ExtensionThe official VS Code extension for PKGShell packages delivers full syntax highlighting, IntelliSense, diagnostics, and workflow helpers for Table of Contents
OverviewPKGShell files combine INI sections,
Highlights
InstallationVisual Studio Code Marketplace
Manual Installation
Supported Files
IntelliSense & Editor AidsCommand Properties
|
| Rule | Purpose | Quick Fix |
|---|---|---|
| DuplicateCommand | Duplicate CommandN entries inside a section |
Renumber to the next free ID and update related properties |
| InvalidCommandProperty | Unknown CommandN.* property |
Diagnostic message (no auto-fix) |
| InvalidCommandSyntax | Bare set lines without a CommandN prefix |
Convert to CommandNN = SET ... and renumber as needed |
| InvalidVariable | %VAR% is undefined |
Highlights location so the missing source can be added |
| WrongCommandOrder | Lower command number follows a higher one | Quick Fix "Renumber commands sequentially" |
| MissingTestSection | TEST:<name> lacks a [TEST:<name>] block |
Automatically insert the missing TEST section |
| MissingLabel | GOTO/IF refers to a label that does not exist |
Diagnostic message |
| MissingSubSection | SUB:<name> lacks a [SUB:<name>] block |
Create an empty SUB section with a placeholder command |
| InvalidIfSyntax | IF statement missing the :expr:number structure |
Diagnostic message |
| InvalidExpression | Malformed expressions | Diagnostic message |
| InvalidProgramOption | Unsupported option or data type in a program header | Diagnostic message |
| DeprecatedParameters | Flags legacy package options such as FinalStatus, IgnoreError, Reboot, or Verify |
Diagnostic message |
| MaintenanceWindowCoach | Warns about inconsistent combinations of Schedule, MaxReject, Logoff, Kickstart, ManualClose, and Close |
Diagnostic message |
| ExecutionModeSanity | Enforces valid Direct/Logoff/Dialog combinations and disallows Direct=1 sections from calling PKG: or reboot hooks |
Diagnostic message |
| DialogRebootGuard | Flags Command*.DoReboot/SuppressReboot/Retry when Dialog=1 because dialog mode cannot reboot the user session |
Diagnostic message |
| PackageDefinition | Required keys missing in [Package Definition] |
Quick Fix inserts the keys with default values |
| InvalidPkgCommand | PKG: missing its target |
Quick Fix inserts PKG:OtherPackage as a placeholder |
| MissingPkgTarget | PKG:Name[:Program] references an unknown package/program |
Diagnostic message |
| CommandNumbering | Gaps or duplicates in numbering | Quick Fix "Renumber commands sequentially" |
| UnusedSections | [SUB:*] or [TEST:*] blocks exist but are never referenced (reserved [TEST:Required/PreQueue/Success] are ignored) |
Diagnostic message |
All diagnostics show up in the Problems panel and support VS Code Code Actions (F1 → Quick Fix).
Formatter & Style Guide
- Normalizes
CommandIDs (Command01,Command10), properties (Command10.Hidden = 1), and section names. - Enforces blank lines between sections, commands, and comment blocks.
- Uppercases
TEST:/SUB:references and camel-cases[Package Definition]keys. - Runs via
Shift+Alt+For on save (depending on your VS Code settings) usingformatPkgshellDocument.
Commands & Tools
Command Palette
| Command | Description |
|---|---|
PKGShell: Renum (pkgshell.resequenceCommands) |
Prompts for an increment (default 10) and renumbers every CommandN per section, including attached properties. Ideal for inserting new steps without collisions. |
PKGShell: Wrap Selected Commands In SUB (pkgshell.wrapSelectionInSub) |
Moves the selected commands—properties, guards, Foreach definitions, etc.—into a new [SUB:<name>] section and replaces the first command in-place with CommandNN = SUB:<name>. Useful for factoring reusable blocks or preparing PKG sub-calls. |
PKGShell: Show PKG Dependency Graph (pkgshell.showPkgGraph) |
Focuses the PKGShell PKG Graph view, which renders the current package plus all PKG: dependencies, unresolved calls, and detected cycles in a tree. |
PKGShell: Show SUB/TEST Dependency Map (pkgshell.showStructureGraph) |
Opens the PKGShell SUB/TEST Graph view that lists every [SUB:*]/[TEST:*] section, its callers, nested references, and unused definitions. |
PKGShell: Open Expression Playground (pkgshell.openExpressionPlayground) |
Opens the PKGShell Expressions view that evaluates %{…}% snippets or [TEST:*] blocks against mock data editable in JSON form. |
CodeLens
[SUB:*]and[TEST:*]headers show reference counters (for exampleSUB:Cleanup (3 references)). Clicking opens the VS Code references peek.PKG:lines receive a lensOpen PKG:Name[:Program]. Selecting it opens the referenced INI and optionally focuses the program section.
Additional Tools
- Quick Fixes (see table above) automate repetitive tasks such as creating missing sections, inserting placeholders, or cleaning up numbering.
PKG:lines are validated against a workspace-wide package index (rules/utils/packageIndex.js).- The PKGShell PKG Graph view (Explorer sidebar) traverses the package index to display sub-package chains, unresolved/variable targets, and cycle warnings with one-click navigation into every referenced package.
- The PKGShell SUB/TEST Graph view inspects every
[SUB:*],[TEST:*], andCommand = SUB/TEST:usage to reveal callers, recursive chains, and unused definitions. - The PKGShell Expressions view provides an interactive playground for single expressions or full
[TEST:*]blocks, complete with editable mock environment data forDiskFreeMB,FileExist,RegExist,ServiceExist,Wmi*, and related functions. WAITwithout a duration is valid (indefinite wait) and is no longer flagged by validation.
Themes & Highlighting
- PKGShell now advertises standard TextMate scopes (e.g.,
entity.name.function,variable.parameter) so whatever VS Code theme you run colors the language naturally. - The extension preconfigures
editor.tokenColorCustomizationswith rules that target only*.pkgshellscopes, restoring the familiar PKGShell palette without hijacking other languages. Override these colors via Settings → editor.tokenColorCustomizations if you prefer a different look. - Inline
powershell.exe/pwsh.exe -Commandpayloads embed the stock PowerShell grammar, so the script portion receives full PowerShell highlighting while the surrounding PKGShell tokens keep their own colors. - The TextMate grammar
syntaxes/pkgshell.tmLanguage.jsonstill covers comments,%VAR%,TEST:/SUB:headers, PKG/IF/GOTO, expression operators, and strings.
Example Workflow
- Open your
pkgshell.ini. VS Code should detect thePkgshelllanguage automatically. - Insert a new command block and use
Command20.→ IntelliSense to add properties. - Type
%inside the command to reference variables or environment values. Hover to confirm the resolved value and source. - Author the logic for
Command20.Success→ expression IntelliSense suggests functions likeFileExistandDateDiff. - Use
F8to iterate through diagnostics and apply Quick Fixes to create missing[TEST:*]or[SUB:*]sections. - Run
PKGShell: Renumwhenever you need to close numbering gaps. - Format the document (
Shift+Alt+F) to align spacing, casing, and section layout.
License & Versioning
- License: See
LICENSE.md(proprietary, all rights reserved). - Versioning: SemVer (
package.json). Detailed changes are listed inCHANGELOG.md. - The README doubles as the Marketplace description—update both whenever new capabilities ship.