mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-12 04:52:53 +01:00
port nvim-jdtls config to fennel and improve noice UI
This commit is contained in:
parent
4a9ae89434
commit
3b1c623c9b
3 changed files with 41 additions and 55 deletions
36
mzte-nv/conf/ftplugin/java.fnl
Normal file
36
mzte-nv/conf/ftplugin/java.fnl
Normal file
|
@ -0,0 +1,36 @@
|
|||
;; Setup for JDTLS
|
||||
|
||||
(local (jdtls jdtls-setup mztenv)
|
||||
(values (require :jdtls) (require :jdtls.setup)
|
||||
(. (require :mzte_nv) :jdtls)))
|
||||
|
||||
(local caps
|
||||
((. (require :cmp_nvim_lsp) :default_capabilities) (vim.lsp.protocol.make_client_capabilities)))
|
||||
|
||||
(local (bundle-info dirs) (values (mztenv.getBundleInfo) (mztenv.getDirs)))
|
||||
|
||||
(fn on-attach [client _]
|
||||
;; formatting is handled by clang-format
|
||||
(set client.server_capabilities.documentFormattingProvider false)
|
||||
;; java lsp has shit highlights
|
||||
(set client.server_capabilities.semanticTokensProvider false)
|
||||
(jdtls-setup.add_commands)
|
||||
(jdtls.setup_dap {:hotcodereplace :auto}))
|
||||
|
||||
(let [opts {:cmd [:jdtls :-configuration dirs.config :-data dirs.workspace]
|
||||
:capabilities caps
|
||||
:root_dir (jdtls-setup.find_root [:.git
|
||||
:mvnw
|
||||
:gradlew
|
||||
:build.grable])
|
||||
:settings {:java {:configuration {:runtimes (mztenv.findRuntimes)}
|
||||
:contentProvider bundle-info.content_provider}}
|
||||
:init_options {:bundles bundle-info.bundles
|
||||
:extendedClientCapabilities (let [cap jdtls.extendedClientCapabilities]
|
||||
(set cap.resolveAdditionalTextEditsSupport
|
||||
true)
|
||||
cap)}
|
||||
:on_attach on-attach
|
||||
:handlers {;; deactivate spammy messages
|
||||
:language/status (fn [])}}]
|
||||
(jdtls.start_or_attach opts))
|
|
@ -1,54 +0,0 @@
|
|||
local jdtls = require "jdtls"
|
||||
local mztenv = require("mzte_nv").jdtls
|
||||
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
local bundle_info = mztenv.getBundleInfo()
|
||||
local dirs = mztenv.getDirs()
|
||||
|
||||
jdtls.start_or_attach {
|
||||
cmd = {
|
||||
"jdtls",
|
||||
"-configuration",
|
||||
dirs.config,
|
||||
"-data",
|
||||
dirs.workspace,
|
||||
},
|
||||
|
||||
capabilities = caps,
|
||||
|
||||
root_dir = require("jdtls.setup").find_root {
|
||||
".git",
|
||||
"mvnw",
|
||||
"gradlew",
|
||||
"build.gradle",
|
||||
},
|
||||
|
||||
settings = {
|
||||
java = {
|
||||
configuration = {
|
||||
runtimes = mztenv.findRuntimes(),
|
||||
},
|
||||
contentProvider = bundle_info.content_provider,
|
||||
},
|
||||
},
|
||||
|
||||
init_options = {
|
||||
bundles = bundle_info.bundles,
|
||||
extendedClientCapabilities = {
|
||||
-- better progress indication in fidget.nvim
|
||||
progressReportProvider = false,
|
||||
},
|
||||
},
|
||||
|
||||
on_attach = function(client, _)
|
||||
-- formatting is handled by clang-format
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
-- java lsp has shit highlights
|
||||
client.server_capabilities.semanticTokensProvider = false
|
||||
require("jdtls.setup").add_commands()
|
||||
jdtls.setup_dap {
|
||||
hotcodereplace = "auto",
|
||||
}
|
||||
end,
|
||||
}
|
|
@ -4,6 +4,10 @@
|
|||
:vim.lsp.util.stylize_markdown
|
||||
:cmp.entry.get_documentation])
|
||||
|
||||
(noice.setup {:message {:view :mini}
|
||||
(noice.setup {:messages {:view :mini}
|
||||
:lsp {:override (collect [_ o (ipairs overrides)] (values o true))}
|
||||
:presets {:lsp_doc_border true}})
|
||||
|
||||
;; Shift-Enter to redirect cmdline
|
||||
(vim.keymap.set :c :<S-Enter> #(noice.redirect (vim.fn.getcmdline))
|
||||
{:desc "Redirect Cmdline"})
|
||||
|
|
Loading…
Reference in a new issue