News

VS Code Now Sports Emmet 2.0, for Faster Coding with Snippets

The Visual Studio Code team this week announced improvements to the editor's Emmet experience, which speeds up development via expandable code snippets.

Emmet has been around for years as an extension for the Visual Studio IDE. As we reported in 2014, it's a dynamic snippeting engine for HTML, XML and CSS coding, previously called Zen Coding. Basically, it lets developers type a shortcut that gets expanded into a complete code snippet, with an ability to write shortcuts as expressions that expand using input from the expression.

Now, the VS Code team has converted Emmet from one big library into an extension, the same delivery method used in the full-blown Visual Studio IDE.

Specifically, in the July 2017 release of Visual Studio Code (version 1.15), all Emmet actions have been rewritten, based on newly available @emmetio npm modules, Microsoft announced Monday.

Emmet in Action
[Click on image for larger, animated GIF.] Emmet in Animated Action (source: Microsoft).

The rewrite converted the monolithic, open source Emmet library into a new modular approach based on smaller, re-usable components, as envisioned by author Sergey Chikuyonok, the VS Code team said. Now, different parts of the Emmet pipeline used to expand snippet abbreviations are handled by separate modules for: parsing an abbreviation; resolving snippets and variables; rendering output according to syntax; and applying transformations.

"This modular approach was taken to allow editor plugins to use the editor specific APIs for better Emmet integration with the editor features," said Microsoft's Ramya Rao in Monday's post, which continued on to say the modular approach lets the team:

  • Provide Emmet abbreviation expansions in the suggestion/auto-completion list
  • Provide multi cursor support for most of the Emmet actions
  • Provide more efficient parsing of documents using VS Code specific APIs for Emmet actions that need parsed files
  • Pull the Emmet integration out of the VS Code core and into an extension

The two previous releases of VS Code included the new Emmet functionality in preview, but now it has been finalized in Emmet 2.0, which features: Emmet abbreviation expansions in suggestion/auto-completion lists; multi-cursor support for most Emmet actions; and updated support for custom Emmet snippets.

"It is also easier than ever to contribute to Emmet in VS Code as it is now an extension," Rao said. "The emmet folder in the VS Code GitHub repo has all the source code you need to get started."

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube