aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2021-03-08 19:46:18 +0100
committerMatthieu Coudron <mcoudron@hotmail.com>2021-07-20 21:57:27 +0200
commitab103e12314e7a134b92da2219340e5a11e2c9d7 (patch)
tree1dfb53c04b808d16c856ee374d5eab5156845de0
parent[docgen] Update CONFIG.md (diff)
downloadnvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar.gz
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar.bz2
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar.lz
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar.xz
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.tar.zst
nvim-lspconfig-ab103e12314e7a134b92da2219340e5a11e2c9d7.zip
fix(hls): log is configured via haskell.logFile
and not languageServerHaskell.logFile display server pid
-rw-r--r--lua/lspconfig/hls.lua19
-rw-r--r--lua/lspconfig/lspinfo.lua26
2 files changed, 32 insertions, 13 deletions
diff --git a/lua/lspconfig/hls.lua b/lua/lspconfig/hls.lua
index b0df2fa0..38975c22 100644
--- a/lua/lspconfig/hls.lua
+++ b/lua/lspconfig/hls.lua
@@ -7,16 +7,25 @@ configs.hls = {
filetypes = { 'haskell', 'lhaskell' },
root_dir = util.root_pattern('*.cabal', 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml'),
settings = {
- languageServerHaskell = {
+ haskell = {
formattingProvider = 'ormolu',
},
},
lspinfo = function(cfg)
- -- return "specific"
- if cfg.settings.languageServerHaskell.logFile or false then
- return 'logfile: ' .. cfg.settings.languageServerHaskell.logFile
+ local extra = {}
+ local function on_stdout(_, data, _)
+ local version = data[1]
+ table.insert(extra, 'version: ' .. version)
end
- return ''
+
+ 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,
},
diff --git a/lua/lspconfig/lspinfo.lua b/lua/lspconfig/lspinfo.lua
index 2e96b440..d12a9859 100644
--- a/lua/lspconfig/lspinfo.lua
+++ b/lua/lspconfig/lspinfo.lua
@@ -49,19 +49,29 @@ return function()
local indent = ' '
local function make_client_info(client)
- local server_specific_info = ''
- if client.config.lspinfo then
- server_specific_info = client.config.lspinfo(client.config)
- end
- return {
+ local lines = {
'',
- indent .. 'Client: ' .. client.name .. ' (id ' .. tostring(client.id) .. ')',
+ indent
+ .. 'Client: '
+ .. client.name
+ .. ' (id: '
+ .. tostring(client.id)
+ .. ' pid: '
+ .. tostring(client.rpc.pid)
+ .. ')',
indent .. '\troot: ' .. client.workspaceFolders[1].name,
indent .. '\tfiletypes: ' .. table.concat(client.config.filetypes or {}, ', '),
indent .. '\tcmd: ' .. remove_newlines(client.config.cmd),
- indent .. '\t' .. server_specific_info,
- '',
}
+ if client.config.lspinfo then
+ local server_specific_info = client.config.lspinfo(client.config)
+ server_specific_info = vim.tbl_map(function(val)
+ return indent .. '\t' .. val
+ end, server_specific_info)
+ lines = vim.list_extend(lines, server_specific_info)
+ end
+
+ return lines
end
for _, client in pairs(buf_clients) do