-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Enable Metals for java files #5707
Conversation
@@ -1057,7 +1057,7 @@ source = { git = "https://github.com/UserNobody14/tree-sitter-dart", rev = "2d7f | |||
name = "scala" | |||
scope = "source.scala" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if I should add source.java
here as well
This messes with java development. Java is it's own language with it's own languages.toml entry, tree sitter queried grammar and lsp. Multiple languages with the same filed types causes conflicts (helix will more or less randomly decide which language to associate with a file then). Instead you can change the lsp for java in your personal config. |
This could be a recommended configuration under https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers#metals, but you would want to change the # ~/.config/helix/languages.toml
[[language]]
name = "java"
language-server = { command = "metals", language-id = "java" } |
Thanks for the explanation, I will update doc then https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers#metals. But regarding the proposed config in |
Also could the language config be done per project one #3207 is merged ? |
#3207 is only required for config.toml. |
I'm not sure if it will spawn a new one: I think the language server registry is keyed off of language-id if I remember correctly rather than binary name so I would guess that Helix will spawn a new metals server. I don't think there's a way to tell Helix to re-use a language server across languages currently. That might be a nice improvement for front-end languages too since javascript, jsx, typescript and tsx all use the same language server configuration but for different language-id's. |
It is very common in Scala projects to use java dependencies and in such context Metals should be enabled for java files.