Compare commits

..
Author SHA1 Message Date
532d0c18f0 fix(lsp): tinymist lsp config 2026-04-16 13:00:20 +01:00
d11f861e6a fix(lsp): tweak settings for pyright 2026-04-16 07:47:12 +01:00
88a3b7f8f2 fix: give up on arduino lsp, it's horrible. 2026-04-11 10:20:35 +01:00
bda43148f0 add: Arduino support (syntax+LSP) 2026-04-10 22:23:52 +01:00
63d77e77e0 ench: disable folding 2026-04-09 17:30:25 +01:00
467ada0932 fix(LSP): rust-analyzer config 2026-04-09 17:24:15 +01:00
4ce1251569 fix(TS): update syntax to 0.12 rewrite 2026-04-09 17:19:21 +01:00
bf712c1187 fix(TS): switch to main branch 2026-04-09 16:57:13 +01:00
c7da0740af fix: fix jdtls config
- use envvar-provided paths for jdk config
- specify filetypes
- ask to not validate java, because OMG please no
- use CLASSPATH to derive referenced libraries
2026-04-09 16:37:36 +01:00
057528c0bf fix(lsp): nil-ls (nix) config 2026-04-09 15:44:40 +01:00
416e2b4347 fix(lsp): lua-ls config 2026-04-09 15:44:32 +01:00
623b9609bc fix: remove mason 2026-04-09 15:43:39 +01:00
127efe1c62 add: configure nil_ls (nix lsp) 2026-04-09 14:32:41 +01:00
88963456de rem: nvim-java 2026-04-09 14:25:43 +01:00
d8af800fc6 lsp: remove tinymist from autoinstalled lsps 2026-03-29 14:50:29 +01:00
513f66f3b3 fix: no nil_ls, clangd, rust-analyzer autoinstall 2026-03-21 19:25:06 +00:00
1618c872f5 fix: r-a recursive panic fix 2026-03-21 19:24:03 +00:00
6b1f33a019 add: nil_ls (nix lsp) 2026-03-21 19:24:03 +00:00
22 changed files with 148 additions and 269 deletions

View file

@ -8,3 +8,5 @@ require 'dzu.keymaps'
require 'dzu.plugins' require 'dzu.plugins'
require 'dzu.snippets' require 'dzu.snippets'
require 'dzu.lsp'

52
nvim/lua/dzu/lsp.lua Normal file
View file

@ -0,0 +1,52 @@
local servers = {
"rust_analyzer",
"pyright",
"ts_ls",
"biome",
"clangd",
"lua_ls",
"tinymist",
"jdtls",
"html",
"dockerls",
"nil_ls",
}
local is_ok, handlers = pcall(require, "dzu.lsp.handlers")
if not is_ok then
vim.notify("failed to initialize LSP handlers")
return
end
handlers.setup()
local opts = {
capabilities = handlers.capabilities,
}
for _, server in pairs(servers) do
server = vim.split(server, "@")[1]
local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server)
if not is_ok then
vim.notify("Failed to initialize config for " .. server)
goto continue
end
local opts0 = vim.tbl_deep_extend("force", opts, conf_opts)
vim.lsp.config(server, opts0)
vim.lsp.enable(server, true)
::continue::
end
-- -- format code on save
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
-- pattern = {
-- "*.rs", -- rust sources
-- "*.py", -- python sources
-- "*.js", -- javascript sources
-- "*.html", -- html files
-- },
-- callback = function(ev)
-- vim.lsp.buf.format()
-- end,
-- })

View file

@ -0,0 +1 @@
return {}

View file

@ -1,6 +1,6 @@
return { return {
filetypes = { "c", "h", "cpp" }, filetypes = { "c", "h", "cpp", "arduino" },
single_file_support = true, root_markers = { ".git", "sketch.yaml" },
cmd = { cmd = {
"clangd", "clangd",
-- "-Wall", -- "-Wall",

View file

@ -0,0 +1 @@
return {}

View file

@ -1,19 +0,0 @@
-- setup LSPs
local is_ok, _ = pcall(require, "dzu.lsp.mason")
if not is_ok then
vim.notify("failed to setup Mason")
return
end
-- -- format code on save
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
-- pattern = {
-- "*.rs", -- rust sources
-- "*.py", -- python sources
-- "*.js", -- javascript sources
-- "*.html", -- html files
-- },
-- callback = function(ev)
-- vim.lsp.buf.format()
-- end,
-- })

View file

@ -1,19 +1,41 @@
local jdk_name = os.getenv("JDTLS_JDK_NAME")
local jdk_path = os.getenv("JDTLS_JDK_PATH")
local classpath = os.getenv("CLASSPATH") or ""
local jdtls_libs = {}
for path in string.gmatch(classpath, "[^:]+") do
if string.len(path) == 0 then
-- empty path, nothing to do
goto continue
end
if string.sub(path, -4) ~= ".jar" then
-- not a jar in path, skip
goto continue
end
table.insert(jdtls_libs, path)
::continue::
end
return { return {
cmd = { "jdtls", "--java-no-verify" },
filetypes = { "java" },
root_markers = { ".git", "build.xml" },
settings = { settings = {
java = { java = {
configuration = { configuration = {
runtimes = { runtimes = {
{ {
name = "openjdk 21.0.9", name = jdk_name,
path = "/usr/lib/jvm/java-21-openjdk/", path = jdk_path,
default = true, default = true,
} }
} }
}, },
project = { project = {
referencedLibraries = { referencedLibraries = jdtls_libs,
'./lib/*.jar',
},
} }
} }
}, },
@ -43,5 +65,4 @@ return {
} }
}, },
init_options = {}, init_options = {},
root_markers = { "build.xml" },
} }

View file

@ -1,4 +1,7 @@
return { return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {

View file

@ -1,85 +0,0 @@
local settings = {
ui = {
border = "none",
icons = {
package_installed = "◍",
package_pending = "◍",
package_uninstalled = "◍",
},
},
log_level = vim.log.levels.INFO,
max_concurrent_installers = 4,
}
require("mason").setup(settings)
local servers = {
{ "rust_analyzer", "rust_analyzer" },
{ "pyright", "pyright" },
{ "ts_ls", nil },
{ "biome", nil },
{ "clangd", "clangd" },
{ "lua_ls", "lua_ls" },
{ "tinymist", "tinymist" },
{ nil, "jdtls" },
{ "html", nil },
{ "dockerls", nil },
}
local ensure_installed = {}
local i = 1
for _, s in pairs(servers) do
local s0 = s[1]
if s0 ~= nil then
table.insert(ensure_installed, i, s0)
i = i + 1
vim.lsp.enable(s0, true)
end
end
for tool, _ in pairs(ADDITIONAL_MASON_TOOLS) do
table.insert(ensure_installed, i, tool)
i = i + 1
end
require("mason-tool-installer").setup({
ensure_installed = ensure_installed,
auto_update = true,
run_on_start = true,
})
require("mason-lspconfig").setup({
automatic_enable = true,
automatic_installation = true,
})
local config_servers = {}
for _, s in pairs(servers) do
local s1 = s[2]
if s1 ~= nil then
table.insert(config_servers, s1)
end
end
local is_ok, handlers = pcall(require, "dzu.lsp.handlers")
if not is_ok then
vim.notify("failed to initialize LSP handlers")
return
end
handlers.setup()
local opts = {
capabilities = handlers.capabilities,
}
for _, server in pairs(config_servers) do
server = vim.split(server, "@")[1]
local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server)
if not is_ok then
vim.notify("Failed to initialize config for " .. server)
goto continue
end
local opts0 = vim.tbl_deep_extend("force", conf_opts, opts)
vim.lsp.config(server, opts0)
vim.lsp.enable(server, true)
::continue::
end

View file

@ -0,0 +1,5 @@
return {
cmd = { "nil" },
root_markers = { { "flake.nix", "flake.lock" }, ".git" },
filetypes = { "nix" },
}

View file

@ -1,4 +1,7 @@
return { return {
cmd = { "pyright-langserver", "--stdio" },
filetypes = { "python" },
root_markers = { ".git" },
settings = { settings = {
pyright = { pyright = {
disableLanguageServices = false, disableLanguageServices = false,

View file

@ -1,4 +1,7 @@
return { return {
cmd = { "rust-analyzer" },
filetypes = { "rust" },
root_markers = { ".git", "Cargo.lock" },
settings = { settings = {
['rust-analyzer'] = { ['rust-analyzer'] = {
diagnostics = { diagnostics = {
@ -19,7 +22,7 @@ return {
enable = true -- show me bounds(?) enable = true -- show me bounds(?)
}, },
termSearch = { termSearch = {
enable = true, -- nested completions? enable = false, -- nested completions?
}, },
}, },
hover = { hover = {

View file

@ -10,6 +10,9 @@ vim.api.nvim_create_user_command("OpenPdf", function()
end, {}) end, {})
return { return {
cmd = { "tinymist" },
filetypes = { "typst" },
root_markers = { ".git", "main.typ" },
settings = { settings = {
formatterMode = "typstyle", formatterMode = "typstyle",
exportPdf = "onType", exportPdf = "onType",

View file

@ -0,0 +1 @@
return {}

View file

@ -58,6 +58,9 @@ local options = {
-- clipboard -- clipboard
clipboard = 'unnamedplus', clipboard = 'unnamedplus',
-- no folding
foldenable = false,
} }
for k, v in pairs(options) do for k, v in pairs(options) do

View file

@ -1,11 +0,0 @@
return {
"mason-org/mason-lspconfig.nvim",
dependencies = {
"mason-org/mason.nvim",
"neovim/nvim-lspconfig",
-- lsp completions
"hrsh7th/cmp-nvim-lsp",
'nvim-java/nvim-java',
},
lazy = false,
}

View file

@ -1,29 +0,0 @@
local function config()
local is_ok, _ = pcall(require, "mason-tool-installer")
if not is_ok then
vim.notify("Failed to setup mason tools")
return
end
local is_ok, _ = pcall(require, "dzu.lsp")
if not is_ok then
vim.notify("failed to setup lsp")
return
end
end
return {
"WhoIsSethDaniel/mason-tool-installer.nvim",
dependencies = {
"mason-org/mason-lspconfig.nvim",
},
config = config,
lazy = false,
opts = {
integrations = {
["mason-lspconfig"] = true,
["mason-null-ls"] = false,
["mason-nvim-dap"] = false,
},
},
}

View file

@ -1,4 +0,0 @@
return {
"mason-org/mason.nvim",
opts = {}
}

View file

@ -203,6 +203,7 @@ end
return { return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { dependencies = {
"cmp-nvim-lsp",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",

View file

@ -1,56 +0,0 @@
return {
'nvim-java/nvim-java',
config = function()
require('java').setup({
-- Startup checks
checks = {
nvim_version = true, -- Check Neovim version
nvim_jdtls_conflict = true, -- Check for nvim-jdtls conflict
},
-- JDTLS configuration
jdtls = {
version = '1.54.0',
},
-- Extensions
lombok = {
enable = false,
version = '1.18.40',
},
java_test = {
enable = false,
version = '0.40.1',
},
java_debug_adapter = {
enable = false,
version = '0.58.2',
},
spring_boot_tools = {
enable = false,
version = '1.55.1',
},
-- JDK installation
jdk = {
auto_install = false,
version = '17',
},
-- Logging
log = {
use_console = false,
use_file = true,
level = 'info',
log_file = vim.fn.stdpath('state') .. '/nvim-java.log',
max_lines = 1000,
show_location = false,
},
})
-- vim.lsp.enable('jdtls')
end,
lazy = false,
}

View file

@ -2,7 +2,7 @@
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
branch = "master", branch = "main",
build = ':TSUpdate', build = ':TSUpdate',
lazy = false, lazy = false,
} }

View file

@ -1,89 +1,73 @@
local M = {} local M = {}
function M.setup() function M.setup()
local is_ok, tree_sitter_config = pcall(require, "nvim-treesitter.configs") local is_ok, tree_sitter = pcall(require, "nvim-treesitter")
if not is_ok then if not is_ok then
vim.notify("couldn't find tree sitter") vim.notify("couldn't find tree sitter")
return return
end end
local cfg = { tree_sitter.setup()
local is_ok, tree_sitter_config = pcall(require, "nvim-treesitter.config")
if not is_ok then
vim.notify("couldn't find tree sitter config")
return
end
local ensure_installed = {
"bash", "bash",
"c", "c",
{ "comment", nil }, "comment",
"csv", "csv",
{ "dockerfile", nil }, "dockerfile",
"fish", "fish",
{ "gitignore", "gitignore" }, "gitignore",
{ "haskell", "hs" }, "haskell",
"html", "html",
{ "javascript", "js" }, "javascript",
{ "typescript", "ts" }, "typescript",
"tsx", "tsx",
"json", "json",
"lua", "lua",
{ "luadoc", nil }, "luadoc",
{ "make", nil }, "make",
{ "markdown", "md" }, "markdown",
{ "markdown_inline", "md" }, "markdown_inline",
{ "python", "py" }, "python",
{ "rust", "rs" }, "rust",
"sql", "sql",
"toml", "toml",
{ "vim", nil }, "vim",
{ "vimdoc", nil }, "vimdoc",
"xml", "xml",
"nu", "nu",
"java", "java",
"yaml", "yaml",
"arduino",
} }
local langs = {}
local li = 1
local pattern = {}
local pi = 1
for _, spec in pairs(cfg) do
if type(spec) == "table" then
table.insert(langs, li, spec[1])
li = li + 1
if type(spec[2]) ~= "nil" then
table.insert(pattern, pi, "*." .. spec[2])
pi = pi + 1
end
else
table.insert(langs, li, spec)
li = li + 1
table.insert(pattern, pi, "*." .. spec)
pi = pi + 1
end
end
table.insert(pattern, pi, "Dockerfile*") -- src: https://www.qu8n.com/posts/treesitter-migration-guide-for-nvim-0-12
pi = pi + 1 local already_installed = require('nvim-treesitter.config').get_installed()
table.insert(pattern, pi, "Cargo.lock") local install = vim.iter(ensure_installed)
pi = pi + 1 :filter(function(parser)
table.insert(pattern, pi, "makefile*") return not vim.tbl_contains(already_installed, parser)
pi = pi + 1 end)
table.insert(pattern, pi, "Makefile*") :totable()
pi = pi + 1 tree_sitter.install(install)
local opts = { vim.treesitter.language.register("xml", "ant")
ensure_installed = langs,
highlight = {
enable = true, -- false will disable the whole extension
},
}
tree_sitter_config.setup(opts)
vim.cmd.TSUpdate() vim.cmd.TSUpdate()
vim.api.nvim_create_autocmd('BufWinEnter', { vim.api.nvim_create_autocmd('FileType', {
pattern = pattern,
callback = function() callback = function()
vim.treesitter.start() -- Enable treesitter highlighting and disable regex syntax
pcall(vim.treesitter.start)
-- Enable treesitter-based indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end, end,
}) })
vim.treesitter.language.register("xml", "ant")
end end
return M return M