Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable in vscode #706

Open
stephan-klein opened this issue Dec 18, 2024 · 1 comment
Open

How to enable in vscode #706

stephan-klein opened this issue Dec 18, 2024 · 1 comment

Comments

@stephan-klein
Copy link

stephan-klein commented Dec 18, 2024

I read all the guides still im puzzled how to enable the plugin in vscode.

I execute

npm install --save-dev --save-exact prettier prettier-plugin-java

I have the prettier extension installed.

and now ? how can i enable the formatting ? Still my other java formatter is executed by default. Format Document with... action does not detect it.

when i put

"[java]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },

in settings.json

i get

image

How to link the plugin to formatting action ?

@clementdessoude
Copy link
Contributor

Hello @stephan-klein !

Do you have a Prettier configuration file ?
If not, can you try creating one like this one (you can convert this one from yaml to any other format) and see if if fixes your issue ?

# Prettier configuration
plugins:
  - prettier-plugin-java
overrides:
  - files:
      - "*.java"
    options:
      printWidth: 100
      tabWidth: 4
      useTabs: false
      trailingComma: "none"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants