mzte-nv: use lspsaga

This commit is contained in:
LordMZTE 2024-04-28 21:58:28 +02:00
parent 5774d8a102
commit 3b65225082
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
11 changed files with 42 additions and 61 deletions

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1714076141,
"narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=",
"lastModified": 1714253743,
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856",
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
"type": "github"
},
"original": {

View file

@ -23,14 +23,9 @@
(nmap :<S-F4> (cmd :cprevious))
;; LSP
(nmap :-a vim.lsp.buf.code_action)
(nmap :-d vim.diagnostic.goto_next)
(nmap :-n vim.lsp.buf.rename)
(nmap :-r #(vim.lsp.buf.format {:async true}))
(nmap :<C-k> vim.lsp.buf.signature_help)
(nmap :<space>e vim.diagnostic.open_float)
(nmap :K vim.lsp.buf.hover)
(vim.keymap.set :i :<C-k> vim.lsp.buf.signature_help opts)
;; command to stop LSPs
(vim.api.nvim_create_user_command :StopLsps

View file

@ -1,5 +0,0 @@
(local aerial (require :aerial))
(aerial.setup {:backends [:lsp :treesitter :markdown :man]})
(vim.keymap.set :n :-o #(aerial.toggle) (. (require :mzte_nv) :utils :map_opt))

View file

@ -9,12 +9,12 @@
:dim_inactive {:enabled true}
;; Enable all relevant integrations
:default_integrations false
:integrations {:aerial true
:cmp true
:integrations {:cmp true
:dap true
:dap_ui true
:gitsigns true
:harpoon true
:lsp_saga true
:markdown true
:native_lsp {:enabled true
:virtual_text (collect [_ diag (ipairs [:errors

View file

@ -1,23 +0,0 @@
(local lightbulb (require :nvim-lightbulb))
(local ignored-clients [:null-ls])
(lightbulb.setup {:ignore {:clients ignored-clients}
;; No gutter sign
:sign {:enabled false}
;; Status bar text
:status_text {:enabled true :text "󱐌"}})
;; Create update autocmd on LSP attach
(fn on-lsp-attach [args]
(let [buf args.buf
client (vim.lsp.get_client_by_id args.data.client_id)]
(when (and client.server_capabilities.codeActionProvider
(not vim.b.mzte_reg_lighbulb_aucmd)
(not (vim.list_contains ignored-clients client.name)))
(set vim.b.mzte_reg_lighbulb_aucmd true)
(vim.api.nvim_create_autocmd :CursorHold
{:buffer buf
:callback lightbulb.update_lightbulb}))))
(vim.api.nvim_create_autocmd :LspAttach {:callback on-lsp-attach})

View file

@ -1,6 +1,5 @@
(local (mztenv lline lightbulb lspprogress)
(values (require :mzte_nv) (require :lualine) (require :nvim-lightbulb)
(require :lsp-progress)))
(local (mztenv lline lspprogress)
(values (require :mzte_nv) (require :lualine) (require :lsp-progress)))
(lline.setup {:options {:theme :catppuccin}
:sections {:lualine_b [:filename :diff]
@ -9,9 +8,6 @@
;; show file name
:mode 1}]
:lualine_c [#(or (. (lspprogress.progress) :msg) "")]
:lualine_x [:searchcount
{1 #(lightbulb.get_status_text)
:color {:fg mztenv.reg.catppuccin-palette.teal}}]
:lualine_y [:branch]}})
(vim.api.nvim_create_autocmd :User

View file

@ -0,0 +1,24 @@
(local lsps (require :lspsaga))
(local mztenv (require :mzte_nv))
(local catppuccin (require :catppuccin.groups.integrations.lsp_saga))
(lsps.setup {:ui {:kind (catppuccin.custom_kind) :code_action "󱐌" :actionfix "󱐌"}
:lightbulb {:enable false}
:code_action {:show_server_name true :extend_gitsigns true}})
(local lsps-codeaction (require :lspsaga.codeaction))
(local lsps-definition (require :lspsaga.definition))
(local lsps-diagnostic (require :lspsaga.diagnostic))
(local lsps-finder (require :lspsaga.finder))
(local lsps-hover (require :lspsaga.hover))
(local lsps-symbol (require :lspsaga.symbol))
(local lsps-rename (require :lspsaga.rename))
(vim.keymap.set :n :-a #(lsps-codeaction:code_action) mztenv.utils.map_opt)
(vim.keymap.set :n :<C-p> #(lsps-definition:init 1 1) mztenv.utils.map_opt)
(vim.keymap.set :n :-d #(lsps-diagnostic:goto_next) mztenv.utils.map_opt)
(vim.keymap.set :n :<C-g> #(lsps-finder:new []) mztenv.utils.map_opt)
(vim.keymap.set :n :K #(lsps-hover:render_hover_doc []) mztenv.utils.map_opt)
(vim.keymap.set :n :-o #(lsps-symbol:outline) mztenv.utils.map_opt)
(vim.keymap.set :n :-n #(lsps-rename:lsp_rename []) mztenv.utils.map_opt)

View file

@ -3,14 +3,10 @@
(macro src [categ name]
`(. nullls :builtins ,categ ,name))
(nullls.setup {:sources [(src :code_actions :gitsigns)
(src :code_actions :shellcheck)
(nullls.setup {:sources [(src :code_actions :shellcheck)
(src :diagnostics :fish)
(src :diagnostics :shellcheck)
(src :diagnostics :tidy)
;; a shitty python formatter
;; TODO: remove once done with involuntary python classes
(src :formatting :black)
(src :formatting :clang_format)
(src :formatting :fish_indent)
(src :formatting :fnlfmt)

View file

@ -11,11 +11,12 @@
(local startup-plugins [])
;; Plugins to load in the background
(local deferred-plugins [:lspconf
(local deferred-plugins [:catppuccin
:lspconf
:lsp-saga
:cmp
:luasnip
:nullls
:catppuccin
:lspprogress
:line
:treesitter
@ -27,12 +28,10 @@
:tterm
:ts-context
:ufo
:aerial
:dap
:harpoon
:recorder
:tsn-actions
:lightbulb
:dressing
:gitsigns])

View file

@ -118,15 +118,15 @@ fn lGetBundleInfo(l: *c.lua_State) !c_int {
// bundles
c.lua_newtable(l);
var has_fernflower = false;
var has_cfr = false;
var iter = dir.iterate();
var idx: c_int = 1;
while (try iter.next()) |f| {
if (f.kind != .file or !std.mem.endsWith(u8, f.name, ".jar"))
continue;
if (!has_fernflower and std.mem.containsAtLeast(u8, f.name, 1, "fernflower"))
has_fernflower = true;
if (!has_cfr and std.mem.containsAtLeast(u8, f.name, 1, "cfr"))
has_cfr = true;
const path = try std.fs.path.joinZ(std.heap.c_allocator, &.{ bundle_path, f.name });
defer std.heap.c_allocator.free(path);
@ -141,8 +141,8 @@ fn lGetBundleInfo(l: *c.lua_State) !c_int {
// content_provider
c.lua_newtable(l);
if (has_fernflower) {
c.lua_pushstring(l, "fernflower");
if (has_cfr) {
c.lua_pushstring(l, "cfr");
c.lua_setfield(l, -2, "preferred");
}

View file

@ -7,6 +7,7 @@ let
"20-lspconfig" = plugin "nvim-lspconfig";
"20-nullls" = plugin "null-ls.nvim";
"20-jdtls" = plugin "nvim-jdtls";
"20-lsp-saga" = plugin "lspsaga.nvim";
# CMP
"45-cmp" = plugin "nvim-cmp";
@ -44,12 +45,10 @@ let
"50-toggleterm" = plugin "toggleterm.nvim";
"50-dressing" = plugin "dressing.nvim";
"50-ufo" = plugin "nvim-ufo";
"50-aerial" = plugin "aerial.nvim";
"50-dap" = plugin "nvim-dap";
"50-dapui" = plugin "nvim-dap-ui";
"50-harpoon" = plugin "harpoon";
"50-recorder" = plugin "nvim-recorder";
"50-lightbulb" = plugin "nvim-lightbulb";
"50-lsp-progress" = plugin "lsp-progress.nvim";
# Libraries