-
Notifications
You must be signed in to change notification settings - Fork 2
LHQ Model v2 Changes
When launched, the LHQ Editor uses model version 1.
The model version serves the following purposes:
- It defines the structure of
*.lhqJSON-like files. - It instructs the LHQ Visual Studio extension to use T4 templates for generating code from
*.lhqfiles.
Note
Due to the reliance on T4 templates, the LHQ extension with *.lhq files and model version 1 is limited to the Visual Studio IDE.
Starting from version 2025.1 of the LHQ Editor VS2022, a new model version 2 has been introduced. This allows code generation from *.lhq files without requiring the Visual Studio IDE.
Key improvements include:
- Code generation within Visual Studio IDE is still supported.
-
*.lhqfiles with model version1will continue to use the legacy T4 templates:- T4 templates are only applicable within the Visual Studio IDE.
- When using other applications (e.g.,
LHQ Editor App,LHQ.Gen.Cmd.exe, or similar), the new modern generator will be automatically employed.
-
*.lhqfiles with model version2will always utilize the new modern generator for code generation.
Model version 2 introduces two new options for templates:
-
Encoding with BOM
- A flag indicating whether the UTF-8 encoding includes a BOM (Byte Order Mark).
-
Line Endings (LF or CRLF)
- Specifies the line endings used when saving generated files to disk.
These options can be configured in the Generate Code Settings section, located in the bottom-right status bar of the editor.
Important
These new options are only supported in model version 2 and later.
The modern generator leverages Handlebars templates, which are powered by the Handlebars.js engine.
This approach was chosen to enable code generation on multiple platforms (Windows, Linux, macOS) in the future. Additionally, it aims to support various contexts such as browsers, Node.js, CI/CD pipelines, cloud services, and VS Code extensions. These enhancements are planned for upcoming releases.
Note
Currently, only Windows applications are supported. These rely on the ChakraCore engine win-x64 to run the Handlebars.js engine.
Applications for other operating systems and platforms (e.g., Linux, macOS) are not yet available.
The modern generator is now accessible through the following applications:
-
- Available from version
2025.1onwards. - Automatically generates code upon saving the
*.lhqfile in the editor.
- Available from version
-
Standalone Desktop Application:
LHQ Editor App- Download the
Lhq.App.Setup.msiinstaller from releases. - Operates independently of Visual Studio.
- Code generation can occur automatically upon saving or manually via the
Generate Codebutton.
- Download the
-
Command-Line Utility:
LHQ.Gen.Cmd.exe- Installed alongside the
Lhq.App.Setup.msi. - Enables code generation directly from the command line for input
*.lhqfiles, without a graphical user interface.
- Installed alongside the
The latest LHQ Editor VS2022 versions (2025.1 and later) maintain compatibility with *.lhq files using model version 1. This is achieved through T4 templates for code generation.
For files using model version 2, the modern generator is employed for code generation across all supported platforms and applications, including:
- VS2022 extension
- Desktop application
- Command-line utility
Once a *.lhq file is upgraded to model version 2, any associated T4 template files (*.lhq.tt) become obsolete and can be safely deleted.
For example:
- An existing model file
Strings.lhquses model version1. - Upgrade
Strings.lhqto model version2:- Update the
model.versionproperty manually in the file. - Or use the UI in the
Project Settingsdialog.
- Update the
- Locate the corresponding
Strings.lhq.ttfile and delete it.
If you encounter issues generating code from *.lhq files after upgrading to model version 2:
- Report the issue on the GitHub issues page.
- Manually edit the
*.lhqfile and change themodel.versionproperty back to1. - Revert to the older model version by downloading v2023.1.