-
Notifications
You must be signed in to change notification settings - Fork 441
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
Indentation configuration #287
Comments
vscode-java doesn't expose formatting options of the underlying Eclipse JDT formatter yet. You currently have 2 options:
The 2nd solution is rather tedious, so the best way to do it is to open your project in eclipse and set the formatting preferences for your project there. In Eclipse, right-click on your project, open Once you save it, No it's not an ideal solution, but it should be done only once, unless you regularly change your formatter settings. |
Thanks for the work around! Any plans on integrating this type of customization? |
It's in our backlog: #2 |
Will keep the discussion open in #2. Closing this one as duplicate (kinda) |
@fbricon The 2nd solution does not works for me. Below is my code. I can't get 4 blank line before methods. Now I have only 1 blank line, as same as the default setting. I don't know if I did something wrong or this is just a bug.
|
@ocavue the solution works for actual projects. What you have is a folder with a java project and a .classpath file. So what defines what an actual project is? At the root of your folder you need to have either:
I strongly suggest you go with making either a Maven or a Gradle project. But if you find that too daunting, a simpler alternative is to use Eclipse to create a new Java project. Then add your java class to your project source folder. Once you have your project structure created, you can close your IDE to open the folder in VS Code. Changing |
@fbricon Sorry for posting a stupid question. I know little about java and your detailed answer is really helpful. Thanks. |
Is there any way to customize the indentation/format rules? The following screenshots should describe what I want to happen
Pre Format
Post Format
I want it to not mess up my custom formatting and simply fix indentation errors. Is this possible?
IntelliJ is able to format code into my pre-format form as well.
The text was updated successfully, but these errors were encountered: