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

lineSplit not working #3683

Closed
lenghan4real opened this issue Jun 24, 2024 · 2 comments
Closed

lineSplit not working #3683

lenghan4real opened this issue Jun 24, 2024 · 2 comments

Comments

@lenghan4real
Copy link

lenghan4real commented Jun 24, 2024

lineSplit in formatter not working

Environment
  • Operating System: MacOS
  • JDK version: 8
  • Visual Studio Code version: 1.90.2
  • Java extension version: v1.32.2024062308 (pre-release)
Steps To Reproduce
  1. configure org.eclipse.jdt.core.formatter.lineSplit=100 locally in a formatter.xml
  2. add "java.format.settings.url": "./formatter.xml",
Current Result

not split at all.

Expected Result

line split when 100

@rgrunber
Copy link
Member

rgrunber commented Jun 24, 2024

I just tried this out and it seems to be working well What does your directory structure look like ? What does your formatter.xml file look like ?

Note that the file given to java.format.settings.url (in your case, formatter.xml) must be a proper xml file. It should be at the root of your project (to match the path your giving) and look something :

formatter.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
  <profile kind="CodeFormatterProfile" name="MyProfile" version="13">
    <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/>
  </profile>
</profiles>

and in your project's .vscode/settings.json, you should have something like :

.vscode/settings.json

{
	"java.format.settings.url": "./formatter.xml"
}

I think even using a user-level setting should work, and it would find your formatter file at the root of the project.

@lenghan4real
Copy link
Author

Seems the profile is incorrect. After correction, it works. Thanks a lot.

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