Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Code in XMLNew to Visual Studio Code? Get it now.
Code in XML

Code in XML

arukumo

|
1 install
| (0) | Free
| Sponsor
Syntax highlighting for embedded code blocks (e.g., <groovy>...</groovy>) in XML files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code in XML

Enables syntax highlighting for embedded code blocks inside XML files. Supported languages are:

  • <groovy>
  • <java>
  • <javascript>
  • <python>
  • <ruby>
  • <sql> | MyBatis tags (<select> / <insert> / <update> / <delete>)
  • <bash> | <shell> | <sh>

🌸 Japanese note
XMLファイルに記述したプログラム言語に対し構文ハイライトを有効にします。言語用の拡張を追加すると、埋め込みコードに言語用の色分けが適用されます。


I initially created this extension to help my team work with XML DSL files containing embedded Groovy code snippets for Apache Camel. Since it proved useful, I expanded it to support other languages like JS, SQL, and MyBatis mapper tags like <select>, <insert>, and so on. For veteran developers, even just the syntax colors are a real help for reading.

Example: Groovy in XML Groovy Example

Example: MyBatis mapper XML MyBatis Example

✨ Features

  • ✅ Syntax highlighting for embedded code blocks inside XML
  • ✅ Supports both CDATA and inline content
  • ✅ The surrounding XML remains fully highlighted
  • ✅ Native support for MyBatis mapper tags (<select>, <insert>, <update>, <delete>) — ideal for complex SQL with comments and special syntax
  • ✅ Supports multiple SQL dialects (Oracle, MySQL, PostgreSQL)
  • ✅ Targets .xml files

⚠️ Note: This extension only provides grammar scopes — it does not highlight, format, or analyze code itself. Colors are applied by VS Code's theme engine using installed language extensions. If embedded code appears uncolored, install the corresponding language extension (see Required Extensions).

📋 Required Extensions

For full syntax highlighting, install language extensions based on the languages you use:

  • Java: Extension Pack for Java (Microsoft)
  • Python: Python (Microsoft)
  • Groovy: Groovy Language Support or similar
  • Ruby: Ruby (Shopify)
  • SQL: SQLTools (mtxr), SQL Server (Microsoft), or PostgreSQL (Microsoft)
  • JavaScript: Built-in to VS Code

Optional

For XML formatting and validation:

  • XML
  • XML Tools

🚀 Installation

Install via Code in XML on the Visual Studio Code Marketplace
or
Manually install from .vsix:

# Example: replace the version number as needed
code --install-extension code-in-xml-1.0.1.vsix

📝 Notes

  • VS Code built-in JavaScript grammar is used automatically (for source.js highlight)
  • In very nested XML structures, some themes may ignore embedded scopes
  • In embedded code, words such as name and status in SQL may be highlighted as keywords by your installed language extension when they match reserved words

📌 Changelog

See CHANGELOG.md for detailed release notes and version history.

⚖️ License

This project is licensed under the MIT License.
Copyright (c) 2025-2026 arukumo.

This extension does not bundle or redistribute third-party grammars.


☕ Support

If you find this extension helpful, a coffee would be greatly appreciated! ☕

Buy Me a Coffee

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft