aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim_lsp/nimls.lua
blob: 5e91c7606a375dfc6fc7ba1a34deadc4ee3a9f39 (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
local configs = require 'nvim_lsp/configs'
local util = require 'nvim_lsp/util'

configs.nimls = {
  default_config = {
    cmd = {"nimlsp",};
    filetypes = {'nim'};
    root_dir = function(fname)
      return util.find_git_ancestor(fname) or vim.loop.os_homedir()
    end;
  };
  docs = {
    package_json = "https://raw.githubusercontent.com/pragmagic/vscode-nim/master/package.json";
    description = [[
https://github.com/PMunch/nimlsp
`nimlsp` can be installed via `:LspInstall nimls` or by yourself the `nimble` package manager:
```sh
nimble install nimlsp
```
    ]];
    default_config = {
      root_dir = [[root_pattern(".git") or os_homedir]];
    };
  };
}

configs.nimls.install = function()
  local script = [[
  nimble install nimlsp
  ]]

  util.sh(script, vim.loop.os_homedir())
end

configs.nimls.install_info = function()
  local script = [[
  nimlsp --version
  ]]

  local status = pcall(vim.fn.system, script)

  return {
    is_installed = status and vim.v.shell_error == 0;
  }
end