Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>JSP FormatterNew to Visual Studio Code? Get it now.
JSP Formatter

JSP Formatter

Thomas Handlag

|
234 installs
| (0) | Free
Format JSP files with HTML, JavaScript, Java, CSS, and JSP-specific syntax support
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSP Formatter

A VS Code extension for formatting JSP (JavaServer Pages) files with comprehensive support for mixed content including HTML, JavaScript, Java, CSS, and JSP-specific syntax.

Features

  • Automatic JSP Formatting: Format .jsp files with proper indentation and structure
  • Multi-Language Support: Handles the complex mix of languages in JSP files:
    • HTML markup
    • JavaScript code within <script> tags
    • CSS code within <style> tags
    • Java code in JSP scriptlets <% %>
    • JSP expressions <%= %>
    • JSP declarations <%! %>
    • JSP directives <%@ %>
  • JSP Comment Support: Properly formats JSP comments <%-- --%> and HTML comments <!-- -->
  • Smart Indentation: Automatically handles nested structures and code blocks
  • Configurable: Respects VS Code's formatting settings (tab size, spaces vs tabs)

Usage

Format Command

  1. Open a .jsp file
  2. Press Shift+Alt+F (Windows/Linux) or Shift+Option+F (macOS)
  3. Or right-click and select "Format Document"
  4. Or use Command Palette: JSP Formatter: Format JSP Document

Auto Format on Save

Enable format on save in your VS Code settings:

{
  "[jsp]": {
    "editor.formatOnSave": true
  }
}

Requirements

  • VS Code version 1.108.1 or higher

Extension Settings

This extension respects the following VS Code settings:

  • editor.tabSize: Number of spaces for indentation
  • editor.insertSpaces: Use spaces instead of tabs

Examples

Before formatting:

<%@page contentType="text/html"%>
<html>
<head>
<title>Example</title>
<style>
body {
background-color: white;
}
</style>
</head>
<body>
<h1>Hello</h1>
<%
String message = "World";
out.println(message);
%>
</body>
</html>

After formatting:

<%@page contentType="text/html"%>
<html>
    <head>
        <title>Example</title>
        <style>
            body {
                background-color: white;
            }
        </style>
    </head>
    <body>
        <h1>Hello</h1>
        <%
            String message = "World";
            out.println(message);
        %>
    </body>
</html>

Known Issues

  • Complex nested structures may require manual adjustment
  • Some advanced JSP tag libraries may not format perfectly

Release Notes

0.0.1

Initial release of JSP Formatter:

  • Basic JSP file formatting
  • Support for HTML, JavaScript, Java, and CSS
  • JSP-specific syntax support (comments, directives, scriptlets, expressions)
  • Configurable indentation settings

Contributing

Found a bug or have a feature request? Please open an issue on the GitHub repository.

License

This extension is provided as-is for educational and commercial use.

Enjoy formatting your JSP files!

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