diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-07-20 13:51:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-20 13:51:07 -0700 |
| commit | dabbf3c8f1114600c8863c127fcc44f242a2264f (patch) | |
| tree | 63d161dadd51e863862c0cac7eac5964f791be18 /lua/lspconfig | |
| parent | [docgen] Update README.md (diff) | |
| parent | feat: add flake.nix (diff) | |
| download | nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar.gz nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar.bz2 nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar.lz nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar.xz nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.tar.zst nvim-lspconfig-dabbf3c8f1114600c8863c127fcc44f242a2264f.zip | |
Merge pull request #853 from teto/fix-haskell
Fix haskell
Diffstat (limited to 'lua/lspconfig')
| -rw-r--r-- | lua/lspconfig/hls.lua | 19 | ||||
| -rw-r--r-- | lua/lspconfig/lspinfo.lua | 26 |
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 |
