Skip to content

madskristensen/PkgdefLanguage

Pkgdef Language for Visual Studio

Build GitHub Sponsors

Download this extension from the Visual Studio Marketplace or get the CI build.


A comprehensive language service for .pkgdef and .pkgundef files that brings modern IDE features to Visual Studio extension development. Write registry configurations faster, catch errors before they cause problems, and keep your code clean with automatic formatting and refactoring.

Features at a Glance

Feature Description
🎨 Syntax Highlighting Color-coded elements for easy reading
💡 IntelliSense Smart completions for variables, registry keys, and values
⚠️ Validation 11 different error checks with detailed messages
🔧 Quick Fixes One-click fixes for common errors
Refactoring Sort properties and add default values
📁 Outlining Collapse sections for better overview
🗺️ Document Outline Navigate registry keys in the Document Outline window
📝 Formatting Consistent code style with one keystroke

Syntax Highlighting

Color-coded syntax makes it easy to parse your documents at a glance. Registry keys, property names, values, variables, and comments are all distinctly styled.

Colorization

IntelliSense

Rich completions throughout your .pkgdef files to speed up development and reduce errors:

Context What You Get
Variables Type $ to see all predefined variables ($RootKey$, $PackageFolder$, $RootFolder$, etc.)
Registry Keys Path suggestions based on your current location in the registry hive
Property Names Common property names after defining a registry key
Property Values Value types (dword:, qword:, hex:), strings, GUIDs, and more

IntelliSense

Validation

Comprehensive validation catches mistakes before they cause runtime issues:

Category Checks
Syntax Unclosed brackets, missing quotes, forward slashes in paths, unknown tokens
Variables Undefined variables, missing $ delimiters, typos in variable names
Registry Values DWORD (8 hex chars), QWORD (16 hex chars), HEX arrays (comma-separated bytes)
Semantics Duplicate registry keys, quoted @ for default values

For detailed information about each validation error, including examples and fixes, see the Error Reference.

Validation

Quick Fixes

Press Ctrl+. on any error to see available one-click fixes:

Error Quick Fix
PL002 - Unclosed registry key Add closing ]
PL003 - Forward slashes Convert / to \
PL004 - Quoted @ sign Remove quotes ("@"@)
PL005 - Unquoted property name Surround with quotes
PL005 - Unclosed string Add closing "
PL006 - Unknown variable Suggest similar variable name
PL007 - Unclosed variable Add closing $
PL008 - Duplicate registry key Consolidate all properties under first occurrence

Code Fix

Refactoring

Beyond error fixes, the extension offers refactoring actions to improve your code:

  • Add default value - Insert @="" for registry keys missing a default value
  • Sort properties - Alphabetically sort properties with @ always first

Access refactoring actions with Ctrl+. when your cursor is on a registry key.

Quick Info

Hover over elements for contextual information:

  • Variables - See descriptions and resolved values for predefined variables like $RootKey$
  • Errors - View detailed error messages with clickable error codes that link to documentation

Quick Info

Outlining

Collapse registry key sections to get a better overview of large documents. Each registry key with its properties forms a collapsible region.

Outlining

Note: Only comments starting with a semicolon (;) are correctly identified as comments, not those starting with //.

Document Outline

The Document Outline window provides a hierarchical view of all registry keys in your .pkgdef file for quick navigation:

  • ViewOther WindowsDocument Outline (or Ctrl+Alt+T)
  • Click any registry key to jump directly to its location
  • Automatically syncs with your cursor position in the editor

This is especially useful for large .pkgdef files with many registry entries.

Formatting

Format your entire document with Ctrl+K, Ctrl+D or just a selection with Ctrl+K, Ctrl+F:

  • Adds consistent line breaks between registry key entries
  • Trims unnecessary whitespace
  • Ensures consistent indentation

Formatting


Contributing

If you enjoy using the extension, please give it a ★★★★★ rating on the Visual Studio Marketplace.

Found a bug or have a feature request? Head over to the GitHub repo to open an issue.

Pull requests are welcome! This is a personal passion project, so contributions help keep it moving forward.

You can also sponsor me on GitHub to support ongoing development.

About

A Visual Studio extension

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages