1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-04 02:30:04 +08:00
SpaceVim/bundle/nvim-lspconfig/lua/lspconfig/server_configurations/hls.lua

56 lines
1.3 KiB
Lua
Raw Normal View History

local util = require 'lspconfig.util'
2021-10-05 15:13:10 +08:00
return {
2021-10-05 15:13:10 +08:00
default_config = {
cmd = { 'haskell-language-server-wrapper', '--lsp' },
filetypes = { 'haskell', 'lhaskell' },
2022-07-24 16:14:35 +08:00
root_dir = function(filepath)
return (
util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath)
or util.root_pattern('*.cabal', 'package.yaml')(filepath)
)
end,
single_file_support = true,
2021-10-05 15:13:10 +08:00
settings = {
haskell = {
formattingProvider = 'ormolu',
},
},
lspinfo = function(cfg)
local extra = {}
local function on_stdout(_, data, _)
local version = data[1]
table.insert(extra, 'version: ' .. version)
end
local opts = {
cwd = cfg.cwd,
stdout_buffered = true,
on_stdout = on_stdout,
}
local chanid = vim.fn.jobstart({ cfg.cmd[1], '--version' }, opts)
vim.fn.jobwait { chanid }
return extra
end,
},
docs = {
description = [[
https://github.com/haskell/haskell-language-server
Haskell Language Server
2022-07-24 16:14:35 +08:00
]],
2021-10-05 15:13:10 +08:00
default_config = {
2022-07-24 16:14:35 +08:00
root_dir = [[
function (filepath)
return (
util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath)
or util.root_pattern('*.cabal', 'package.yaml')(filepath)
)
end
]],
2021-10-05 15:13:10 +08:00
},
},
}