feat: migrate lsp/init.lua to fennel

This commit is contained in:
Youwen Wu 2025-02-01 03:00:48 -08:00
parent 8689c11dd0
commit 49eccb84e2
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 45 additions and 75 deletions

24
fnl/lsp/init.fnl Normal file
View file

@ -0,0 +1,24 @@
{:setup (fn []
(local symbols {:Error "󰅙" :Info "󰋼" :Hint "󰌵" :Warn ""})
(each [name icon (pairs symbols)]
(let [hl (.. :DiagnosticSign name)]
(vim.fn.sign_define hl {:text icon :numhl hl :texthl hl})))
(let [lspconfig (require :lspconfig)]
(lspconfig.lua_ls.setup {:settings {:Lua {:runtime {:version :LuaJIT}
:diagnostics {:globals [:nixCats]}
:telemetry {:enable false}}}})
(lspconfig.nixd.setup {})
(lspconfig.marksman.setup {})
(lspconfig.tinymist.setup {:offset_encoding :utf-8})
(lspconfig.svelte.setup {})
(lspconfig.texlab.setup {})
(lspconfig.clangd.setup {})
(lspconfig.mesonlsp.setup {})
(lspconfig.nushell.setup {})
(lspconfig.vale_ls.setup {:filetypes [:markdown
:text
:tex
:rst
:typst]})
(lspconfig.fennel_ls.setup {}))
{})}

View file

@ -1,78 +1,24 @@
local M = {}
M.setup = function()
local symbols = { Error = "󰅙", Info = "󰋼", Hint = "󰌵", Warn = "" }
-- [nfnl] Compiled from ./fnl/lsp/init.fnl by https://github.com/Olical/nfnl, do not edit.
local function _1_()
local symbols = {Error = "\243\176\133\153", Info = "\243\176\139\188", Hint = "\243\176\140\181", Warn = "\239\129\177"}
for name, icon in pairs(symbols) do
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
local hl = ("DiagnosticSign" .. name)
vim.fn.sign_define(hl, {text = icon, numhl = hl, texthl = hl})
end
do
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
globals = { "nixCats" },
},
-- unfortunately we won't get nixCats autocomplete with this option
-- off, but lazydev will be much faster
--
-- workspace = {
-- -- Make the server aware of Neovim runtime files
-- library = vim.api.nvim_get_runtime_file("", true),
-- -- library =
-- },
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
lspconfig.nixd.setup({
nixd = {
nixpkgs = {
expr = [[import (builtins.getFlake ")]] .. nixCats("nixdExtras.nixpkgs") .. [[") { } ]],
},
-- options = {
-- nixos = {
-- expr = [[(builtins.getFlake "]]
-- .. nixCats("nixdExtras.flake-path")
-- .. [[").nixosConfigurations."]]
-- .. nixCats("nixdExtras.systemCFGname")
-- .. [[".options]],
-- },
-- -- (builtins.getFlake "<path_to_system_flake>").homeConfigurations."<name>".options
-- ["home-manager"] = {
-- expr = [[(builtins.getFlake "]]
-- .. nixCats("nixdExtras.flake-path")
-- .. [[").homeConfigurations."]]
-- .. nixCats("nixdExtras.homeCFGname")
-- .. [[".options]],
-- },
-- },
},
})
lspconfig.lua_ls.setup({settings = {Lua = {runtime = {version = "LuaJIT"}, diagnostics = {globals = {"nixCats"}}, telemetry = {enable = false}}}})
lspconfig.nixd.setup({})
lspconfig.marksman.setup({})
lspconfig.tinymist.setup({
offset_encoding = "utf-8",
})
lspconfig.tinymist.setup({offset_encoding = "utf-8"})
lspconfig.svelte.setup({})
lspconfig.texlab.setup({})
lspconfig.clangd.setup({})
lspconfig.mesonlsp.setup({})
lspconfig.nushell.setup({})
lspconfig.vale_ls.setup({
filetypes = { "markdown", "text", "tex", "rst", "typst" },
})
lspconfig.vale_ls.setup({filetypes = {"markdown", "text", "tex", "rst", "typst"}})
lspconfig.fennel_ls.setup({})
end
return {}
end
return M
return {setup = _1_}