aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-07-20 13:51:07 -0700
committerGitHub <noreply@github.com>2021-07-20 13:51:07 -0700
commitdabbf3c8f1114600c8863c127fcc44f242a2264f (patch)
tree63d161dadd51e863862c0cac7eac5964f791be18
parent[docgen] Update README.md (diff)
parentfeat: add flake.nix (diff)
downloadnvim-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
-rw-r--r--flake.lock25
-rw-r--r--flake.nix17
-rw-r--r--lua/lspconfig/hls.lua19
-rw-r--r--lua/lspconfig/lspinfo.lua26
4 files changed, 74 insertions, 13 deletions
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..dac8dc8e
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,25 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1626644568,
+ "narHash": "sha256-+WxW0u6AJUn/AzIxUuNKtEDxSRcUP0v/iZ/tRXhLGEc=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "d5bd34ebf2c2c2b380b76cb86bc68522bc6af4d7",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..7661b81a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,17 @@
+{
+ description = "Quickstart configurations for the Nvim LSP client";
+
+ outputs = { self, nixpkgs }: let
+ pkgs = import nixpkgs { system = "x86_64-linux";};
+ in {
+
+ devShell."x86_64-linux" = pkgs.mkShell {
+
+ buildInputs = [
+ pkgs.stylua
+ pkgs.luaPackages.luacheck
+ ];
+ };
+
+ };
+}
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