zed
zed copied to clipboard
Add Java support
This pr is created to add java syntax highlighting and lsp (eclipse.jdt.ls)
The PR is not ready to be merged yet because I am encountering some strange issues and would like to hear some suggestions as I am running out of ideas. The problem I am facing is that when Zed is launched and I press "Go to definition" several times, the LSP gets stuck, and I receive a timeout error (no response is received within 2 minutes). Important to mention that bin of the server is not attached to release in eclipse.jdt.ls repo, so I made ci which creates it: https://github.com/ABckh/eclipse.jdt.ls Also, I am experiencing an issue where completion throws an error, but it still functions.
Release Notes:
- Added java support (#5301 ).
I do not think Zed is ready to proceed with Java as a language due to project panel issues:
all long.nested.package.names look really bad there and I believe there was already an issue requesting those to be auto folded somehow; there has to be a horizontal scroll added there (for both folded state and not), etc.
That task seems to be simpler, since can be done entirely in project_panel.rs with new tests there, so I propose to do that first.
@ABckh , I see the 👍 on my project panel proposal, so I assume you also agree we should prioritize that first. I will close this PR, just to avoid it becoming stale: things like https://github.com/zed-industries/zed/pull/6979 might appear and subtly break or conflict with these changes.
Feel free to create a separate issue(s)/PR(s) and ping me if you have any questions about the project panel changes if you plan to work on these.
@ABckh , I see the 👍 on my project panel proposal, so I assume you also agree we should prioritize that first. I will close this PR, just to avoid it becoming stale: things like zed-industries/zed#6979 might appear and subtly break or conflict with these changes.
Feel free to create a separate issue(s)/PR(s) and ping me if you have any questions about the project panel changes if you plan to work on these.
sure, will try to solve issue with packages and then come back to java support
@ABckh this is a great work! I was looking for Java syntax support yesterday, then found this PR. Looking forward to see your upcoming PR.
Hello, I have just started looking into collapsed dirs and I can see 2 options of implementing that:
- IntelliJ-like:
This means that we have some excluded directories which will not be collapsed even if they are "suitable" for collapsing (such as java, src, main, gradle, etc.). My thought to implement that was to change the filename of the entry with the for_each_visible_entry function and then skip child directories which were collapsed in the parent. However, we would then need to implement this move action, as it does not exist yet, if I am not mistaken.
- VSCode-like:
This means collapsing all of the directories. Also, in VSCode, you can select one of the directories which is collapsed, so we could add a file or directory under a specific collapsed directory by clicking on one of the collapsed directories. In IntelliJ, it is implemented in a way where we cannot access one of the directories which are collapsed; they are represented as one entry, and if we want to create a new file or directory, we would use the "move" action where we can change the path of the file. My thought to implement that was to create a flag in details in the for_each_visible_entry function and then render it in one line with the render_entry function.
I would like to hear some suggestions on the implementation and the direction we want to go in. Please feel free to propose other solutions, as mine may not be working since I have not tried any of those yet 🙂
I personally prefer VSCode approach as it looks more compact, but no strong opinion here. Interactivity part of that approach is also compelling, but not sure if we need to do that right away (unless it's simple enough) — I think if we instead add an action to the directory context menu to unfold the children, it would be enough for starters and all the fancy selection/move/etc. features on the collapsed tree may follow later.
One addition to both approaches I'd like to see is a settings toggle that enables/disables this behavior: I'm sure there will be people not fond of the new feature.
The IntelliJ style has always bothered me because the dir1.dir2 style could be the actual name of a single directory. It sometimes makes me second guess what I'm even looking at. The forward slash makes it clear that this is a directory hierarchy.
For IntelliJ, it makes sense they would display it that way since that is the way Java packages are written, but I don't think that should apply to Zed where most languages use completely different directory/package structures.
Seconding the VSCode style, already because of the ability to still interact with any of the subdirectories directly (which AIUI is not possible that nicely with the intellij style?).
This would also be beneficial for inspecting e.g. generated code in rust projects' target/debug/<target-triple>/foo so I'm definitely looking forward to directory folding landing.