What is @vscode/emmet-helper?
@vscode/emmet-helper is a helper library for integrating Emmet functionalities into Visual Studio Code extensions. Emmet is a toolkit for web developers that allows for high-speed coding and editing of HTML, XML, XSL, and other structured code formats via content assist and abbreviation expansion.
What are @vscode/emmet-helper's main functionalities?
Abbreviation Expansion
This feature allows you to expand Emmet abbreviations into full HTML or XML structures. In this example, the abbreviation 'ul>li*3' is expanded into an unordered list with three list items.
const emmet = require('@vscode/emmet-helper');
const expanded = emmet.expandAbbreviation('ul>li*3', 'html');
console.log(expanded); // Outputs: <ul><li></li><li></li><li></li></ul>
Syntax Profiles
This feature allows you to retrieve syntax profiles for different languages. Syntax profiles define how Emmet should expand abbreviations for a particular language.
const emmet = require('@vscode/emmet-helper');
const profile = emmet.getSyntaxProfile('html');
console.log(profile); // Outputs the syntax profile for HTML
Custom Snippets
This feature allows you to retrieve custom snippets for a specific language. Snippets are predefined pieces of code that can be inserted into your codebase.
const emmet = require('@vscode/emmet-helper');
const snippets = emmet.getSnippets('html');
console.log(snippets); // Outputs custom snippets for HTML
Other packages similar to @vscode/emmet-helper
emmet
The 'emmet' package is a standalone implementation of Emmet, which can be used in various editors and IDEs. It provides similar functionalities like abbreviation expansion and custom snippets but is not specifically tailored for integration with Visual Studio Code.
emmet-monaco-es
The 'emmet-monaco-es' package is an Emmet integration for the Monaco Editor, which powers VS Code. It provides similar functionalities but is specifically designed for use with the Monaco Editor rather than VS Code extensions.
vscode-emmet-helper
A helper module to use emmet modules with Visual Studio Code
Visual Studio Code extensions that provide language service and want to provide emmet abbreviation expansions
in auto-complete can include this module and use the doComplete
method.
Just pass the one of the emmet supported syntaxes that you would like the completion provider to use along with other parameters that you would generally pass to a completion provider.
If emmet.includeLanguages
has a mapping for your language, then the builit-in emmet extension will provide
html emmet abbreviations. Ask the user to remove the mapping, if your extension decides to provide
emmet completions using this module