init.lua/lsp/elmls.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
local u = require("core.utils").lsp
---@return vim.lsp.Client
return {
cmd = { "elm-language-server" },
filetypes = { "elm" },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
local filetype = vim.api.nvim_get_option_value("filetype", { buf = 0 })
if
filetype == "elm" or (filetype == "json" and fname:match "elm%.json$")
then
on_dir(vim.fs.root(fname, "elm.json"))
return
end
on_dir(nil)
end,
init_options = {
elmReviewDiagnostics = "warning",
skipInstallPackageConfirmation = false,
disableElmLSDiagnostics = false,
onlyUpdateDiagnosticsOnSave = false,
},
capabilities = u.capabilities {
offsetEncoding = { "utf-8", "utf-16" },
},
}
|