Skip to content

Formatter does not work #43

@vchicoro

Description

@vchicoro

What happened?

If have the following configuration of the plugin on my settings.json file:

  "lsp": {
    "jdtls": {
      "initialization_options": {
        "settings": {
          "java": {
            "jdt": {
              "ls": {
                "java": {
                  "home": "/path/to/java/home"
                }
              }
            },
            "format": {
              "onType": {
                "enabled": true
              },
              "settings": {
                "url": "/path/to/myFormatterFile.xml",
                "profile": "My Formatter Style"
              }
            },
            "saveActions": {
              "organizeImports": true
            }
          },
          "jdt": {
            "ls": {
              "lombokSupport": {
                "enabled": true
              }
            }
          },
          "saveActions": {
            "organizeImports": true
          }
        }
      }
    }
  }

As well as the following to disable prettier for java:

  "languages": {
    "Java": {
      "formatter": "language_server",
      "prettier": {
        "allowed": false
      }
    }
  }

However whenever y use the format buffer command (either from the context menu, using the hotkey or by saving the file with format on save option enabled) it does not work and (i'm assuming here) keeps applying the prettier formatter.

I've tested this config, with the same formatter file and profile in other LSP plugins for other editors and they work as expected (tested in VSCode, Sublime Text and emacs).

What did you expect to happen?

Whenever the formatter should apply it applies the formatter specified in config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededlanguage-serverRelated to the language server.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions