4 ms·
Looks very nice. One thing that always prevents me from using anything other than a full-blown IDE for Java is the fact that most entreprise projects use Maven
by przmk 2y ago
Looks very nice. One thing that always prevents me from using anything other than a full-blown IDE for Java is the fact that most entreprise projects use Maven and structure packages with the default Java way by using the FQDN structure (e.g.: org/example/groupid/packageid/submodule/File.java).
Maybe I'm missing something but navigating and finding/adding files in a structure that's 10-20 directories deep or more seems like a nightmare in pure Vim.
- qup 2y agoyou want the ctrl+p plugin It's a fuzzy file finder. For your example of `org/example/groupid/packageid/submodule/File.java` I might write "[Ctrl+P] pamodFi[Enter]" If `File.java` is unique enough, I can just type that and it finds it without issue. There's also filetree plugins if you really want the visual clutter
- wffurr 2y agoA good fuzzy finder helps a lot with this. You can type something like `ccufFoo` to match `com.company.util.factories.FooWidgetFactory`. I use fzf.vim for this. Thankfully my company has its own hosted LSP that supports Java (and every other language in our bazel monorepo) so I don’t have to mess around with Eclipse and JDTLS (what happened to eclim?). But at a prior company I just worked without an LSP and just did a lot of referencing Java docs in a browser and split screen files.
- le-mark 2y agoI started down that route and decided it was just a lot of work ie mental effort I didn’t want to do. My motivation was eclipse maven plug-in was buggy and sucked at the time. I found (like most) IntelliJ gave a much more pleasant experience. How long have you been doing it and how have you managed to stick with it?
- wffurr 2y agoI wrote Java sans LSP for three years full time (2012-2015), and then occasionally since then. Since 2015, I mostly worked on the web version of our cross platform C++ project but have contributed substantially to the Android and iOS libraries as well.
- fire_lake 2y agoWhat’s the LSP tool that integrates with Bazel? Is it open source?
- wffurr 2y agoNo, it’s not open source alas.
- gorset 2y agoI always found the existing bazel integrations annoying. My solution has been to generate .classpath based on a set of bazel queries. Not what's officially recommended, but it has worked great for the projects I've been involved in. Easy to understand, and keeps bazel completely separate and independent from the IDE experience which has some benefits.
- lsllc 2y agoNot at all -- if you're something like LazyVim with the stock config, then in a large project it's just <leader>ff to search by filename or <leader>sg to grep across the project (using ripgrep!) or for a symbol search <leader>sS (using symbols provided by the LSP). I haven't found anything better than Neovim+Lazyvim and switched from ST4 a couple of years ago and never looked back.
- pjot 2y agoSimilarly, I found the kickstart.nvim immensely helpful as a jumping off point. https://github.com/nvim-lua/kickstart.nvim https://github.com/nvim-lua/kickstart.nvim
- jitl 2y ago<leader><leader> also opens the fuzzy finder in LazyVim. I don’t like it quite as much as <shift><shift> which is the shortcut in Jetbrains but it’s better than <Cmd>-P in VS Code
- lsllc 2y agoYes that works too! I use <leader>fb to fuzzy search over open buffers so <leader>ff is a bit more natural, albeit longer than <leader><leader>. I think my favorite feature is `gr` (in command mode) to "goto references" for the symbol under the cursor. I use this all the time (as well as `gd` for goto definition which with the LSP is really precise).
- mhd 2y agoWouldn't that mostly matter if you're really navigating in your source code via the tree panel? In the post-Textmate days, fuzzy file finders seem to be all the rage whether you're using vim or IDEs (or Sublime etc.). Or you go to definition/references immediately. I mostly use the file navigation when exploring the structure, which I'm not doing that often. And which I probably should do with a class browser anyways, which I used to do often in Eclipse, way back in time, but it seems that particular SmallTalk-ism isn't very popular in contemporary IDEs.
- BeefWellington 2y agoHonestly having one single dedicated F key for jumping anywhere to a class or method definition is, for me, a killer feature that most alternatives lack. I do a lot of kinds of development with Vim, but for certain languages I find it a far better experience to use a language specific IDE.
- mdaniel 2y agoFWIW, that is not a Maven-ism that is actually inherent to Java (the language and the runtime)[1]. Including case-sensitivity for the filename, which was an especially bold choice for Sun to make back in 1990, although I guess they're all "we'll sell more Solaris workstations!!1" or something For example: $ mkdir foo $ cd foo $ printf 'package jimbo;\npublic class Foo2 {}\n' > fred.java $ javac -g -d . fred.java fred.java:2: error: class Foo2 is public, should be declared in a file named Foo2.java public class Foo2 {} ^ 1 error The only exception that I'm aware of is that inner classes don't have to live in their own filename (given that they're more or less property of the owning class) The Maven-ism that I'm aware of is the by default structure of {src/main/java, src/main/resources, src/test/java, src/test/resources} but (of course) those are customizable via the pom.xml if it jams up your project that much 1: https://docs.oracle.com/javase/specs/jls/se6/html/packages.html#7.2.1 https://docs.oracle.com/javase/specs/jls/se6/html/packages.h... (it's the oldest spec version they still link)
- gf000 2y agoPackage hierarchies are used during class loading from a directory, but there is nothing in the spec that mandates that kind of directory structure for the source code. Your link only uses the word "might", not "must".
- brabel 2y ago> The only exception that I'm aware of is that inner classes don't have to live in their own filename Not only inner classes, you can have many top-level classes on the same file but they cannot be public.
- baq 2y agoDoing any work in a project worked on by multiple teams without C-P-style fuzzy file name matching is a recipe for frustration in any editor or IDE, regardless of the language. I've relied on this feature a lot when working in nvim+Python and nowadays in my vscode+typescript job it is one of my most heavily used shortcuts, too.
- konfekt 2y agoTry filepicker.vim [0] to navigate these in one of the many popular millers like lf, yazi, ranger or nnn [0] https://github.com/Konfekt/filepicker.vim https://github.com/Konfekt/filepicker.vim