Closed Rahmerh closed 1 month ago
I do have similar issue then I went down a rabbit hole and finally found this: Indent issue
My workaround, using nvim for editing file and using intellij just for format.. I know its bad but thats all I have :)
This should be moved to a Discussion, as this is a problem related to your configuration and not an actual issue in the plugin.
Btw why don't you set the url inside the format table? And also, can you check the log output of the LSP?
format = {
enabled = true,
settings = {
url = vim.fn.getcwd() .. "/formatter-settings.xml",
},
},
If it doesn't work, this could be an issue with the xml file. The LSP expects all the settings. Partials are ignored š¢ https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/3108
I'm sorry, I wasn't sure at the time of creating this issue if it was due to my configuration or an issue in the project. I'm not sure how to move this to a discussion but yes, this can be moved.
I tried the configuration you provided, but no luck.
I did check the logs and I found this bit:
[ERROR][2024-07-24 07:32:09] ...lsp/handlers.lua:623 "24 Jul 2024, 07:32:09 Illegal character in opaque part at index 2: C:\\Users\\<REDACTED-PATH>\\formatter-settings.xmll\r\n\tat java.base/java.net.URI$Parser.fail(URI.java:2995)\r\n\tat java.base/java.net.URI$Parser.checkChars(URI.java:3166)\r\n\tat java.base/java.net.URI$Parser.parse(URI.java:3202)\r\n\tat java.base/java.net.URI.<init>(URI.java:645)\r\n\tat org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.getURIs(StandardProjectsManager.java:561)\r\n\tat org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.registerWatchers(StandardProjectsManager.java:512)\r\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer$2.run(JDTLanguageServer.java:328)\r\n\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)\r\n"
[ERROR][2024-07-24 07:32:09] ...lsp/handlers.lua:623 "24 Jul 2024, 07:32:09 Illegal character in opaque part at index 2: C:\\Users\\<REDACTED-PATH>\\formatter-settings.xml\r\n\tat java.base/java.net.URI$Parser.fail(URI.java:2995)\r\n\tat java.base/java.net.URI$Parser.checkChars(URI.java:3166)\r\n\tat java.base/java.net.URI$Parser.parse(URI.java:3202)\r\n\tat java.base/java.net.URI.<init>(URI.java:645)\r\n\tat org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.getURIs(StandardProjectsManager.java:561)\r\n\tat org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.registerWatchers(StandardProjectsManager.java:512)\r\n\tat org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager$1.run(StandardProjectsManager.java:131)\r\n\tat org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)\r\n"
I had to slightly edit the log but the key parts are still here.
It doesn't tell me which line this is on, but it's something I haven't noticed before. Any clues what this could be?
Edit: Turns out I'm an idiot! I was using the intellij xml formatter settings, once I exported it as eclipse settings it finally worked! Turns out I had to select a profile for it to work, which didn't exist in intellij's formatter settings. Thanks for the help, I'll close the issue!
Hey good to know it was solved š
LSP client configuration
Eclipse.jdt.ls version
1.37.0
Steps to Reproduce
When I use this small code snippet:
And I use the following format settings:
And I simply format using:
lua vim.lsp.buf.format({ async = false })
Expected Result
Due to the following 2 lines:
I expected it would leave the
)
bracket on the next lineActual Result
Instead, it gets formatted like this:
I'm assuming I have something somewhere configured incorrectly, please let me know if this is something on my end
For reference, my full nvim configuration can be found here: https://github.com/Rahmerh/dotfiles/tree/main/home/.config/nvim
Thanks in advance for your help!