This is a VS Code extension that treats files with a custom file extension (e.g., .hmpl) as HTML. It applies HTML syntax highlighting, auto-closing tags, and other related features to these files.
- Supports any theme compatible with HTML files.
- Auto-closing and auto-pairing of HTML tags.
- Syntax highlighting for
.hmplfiles using standard HTML grammar.
-
Clone or download this repository to your local machine.
-
Open the project folder in Visual Studio Code.
-
Install dependencies (if any) by running:
npm install
-
Package the extension by running:
vsce package
-
Install the generated
.vsixfile in your VS Code:- Open the Extensions view (
Ctrl+Shift+XorCmd+Shift+X). - Click the menu icon (
...) in the top-right corner and select Install from VSIX.... - Select the
.vsixfile you generated.
- Open the Extensions view (
- Open any file with the
.hmplextension in VS Code. - The file will automatically be treated as an HTML file, with syntax highlighting and other features enabled.
Here is a quick overview of the files in this project:
package.json: Metadata and configuration for your extension. Defines the custom file extension and maps it to HTML syntax.language-configuration.json: Configuration for brackets, comments, and auto-closing pairs.syntaxes/html.tmLanguage.json: Contains the grammar rules for HTML syntax highlighting.extension.js: The main script for the extension. Currently, it contains boilerplate code and can be extended for additional features.
To test your extension in VS Code:
- Open the extension project folder in VS Code.
- Press
F5to launch an Extension Development Host. - Open a
.hmplfile in the new window to see your extension in action.
-
Ensure your
package.jsonis properly configured (e.g., name, version, and publisher). -
Run the following command to generate a
.vsixfile:vsce package
-
Publish your extension to the Visual Studio Code Marketplace:
vsce publish
Note: You’ll need a publisher account and a Personal Access Token (PAT) to publish your extension.
This guide should help you understand how to use and develop the HMPL. Feel free to enhance it with additional features or customizations!