Skip to content

Format block of text with specified language #794

Closed

Description

@murdos

It would be nice if prettier-java could delegate to prettier the formatting of block of text that is commented with language = ....

E.g.

// language = json
String someJson = """
{"glossary":{"title": "example glossary"}}
"""

Expected behavior:

// language = json
String someJson = """
{
    "glossary": { 
        "title": "example glossary",
    }
}
"""

language = <language> is supported by Jetbains IDEs: adding this comment allow syntax highlighting, code completion and verification.

This would be similar to what Prettier does out of the box with block of code inside Mardown such as:

```json
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}

Activity

  1. murdos commented on May 16, 2026

    @murdos
    Author

    Hi @jtkiesel,
    Do you plan to do a new release soon including this feature, or do you still have some checks to do related to the switch to tree-sitter?

  2. jtkiesel commented on May 16, 2026

    @jtkiesel
    Contributor

    @murdos Thanks for the reminder! I had some more testing I wanted to do, which turned up an issue caused by the tree-sitter refactor, I was able to quickly resolve it and have released these changes. I had some trouble with the initial release, but 2.9.1 is now available for use. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions