How to use nvim-jdtls for Java and nvim-lspconfig for everything else?

This page summarizes the projects mentioned and recommended in the original post on /r/neovim

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • eclipse.jdt.ls

    Java language server

  • I installed eclipse jdtls which worked for Java, but I was not able to go to definitions for methods/classes outside of my project (ie, libraries and such, something like in IntelliJ where you can go to the definition or implementation for the library code), so I thought it may be a limitation of nvim-lspconfig

  • nvim-jdtls

    Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls

  • I found nvim-jdtls which seems to provide more features for Java and hopefully fix my issue. However, I see that in the README that you should not run both nvim-lspconfig and nvim-jdtls together. I see the recommendation online to put the nvim-jdtls configuration in ~/.config/nvim/ftplugin/java.lua so that it will only run on java files, but if I have nvim-lspconfig automatically running from ~/.config/nvim/after/plugin/lsp.lua file, how can I make it so that nvim-lspconfig doesn't run if it's a Java?

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts