aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/vuels.lua
blob: 4a8774bd039957e809e701276affbfb31dc315aa (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'

local server_name = "vuels"
local bin_name = "vls"

local installer = util.npm_installer {
  server_name = server_name;
  packages = { "vls" };
  binaries = {bin_name};
}

configs[server_name] = {
  default_config = {
    cmd = {bin_name};
    filetypes = {"vue"};
    root_dir = util.root_pattern("package.json", "vue.config.js");
    init_options = {
      config = {
        vetur = {
          useWorkspaceDependencies = false;
          validation = {
            template = true;
            style = true;
            script = true;
          };
          completion = {
            autoImport = false;
            useScaffoldSnippets = false;
            tagCasing = "kebab";
          };
          format = {
            defaultFormatter = {
              js = "none";
              ts = "none";
            };
            defaultFormatterOptions = {};
            scriptInitialIndent = false;
            styleInitialIndent = false;
          }
        };
        css = {};
        html = {
            suggest = {};
        };
        javascript = {
            format = {};
        };
        typescript = {
            format = {};
        };
        emmet = {};
        stylusSupremacy = {};
      };
    };
  };
  on_new_config = function(new_config)
    local install_info = installer.info()
    if install_info.is_installed then
      if type(new_config.cmd) == 'table' then
        -- Try to preserve any additional args from upstream changes.
        new_config.cmd[1] = install_info.binaries[bin_name]
      else
        new_config.cmd = {install_info.binaries[bin_name]}
      end
    end
  end;
  docs = {
    package_json = "https://raw.githubusercontent.com/vuejs/vetur/master/package.json";
    description = [[
https://github.com/vuejs/vetur/tree/master/server

Vue language server(vls)
`vue-language-server` can be installed via `:LspInstall vuels` or by yourself with `npm`:
```sh
npm install -g vls
```
]];
    default_config = {
      root_dir = [[root_pattern("package.json", "vue.config.js")]];
      init_options = {
        config = {
          vetur = {
            useWorkspaceDependencies = false;
            validation = {
              template = true;
              style = true;
              script = true;
            };
            completion = {
              autoImport = false;
              useScaffoldSnippets = false;
              tagCasing = "kebab";
            };
            format = {
              defaultFormatter = {
                js = "none";
                ts = "none";
              };
              defaultFormatterOptions = {};
              scriptInitialIndent = false;
              styleInitialIndent = false;
            }
          };
          css = {};
          html = {
              suggest = {};
          };
          javascript = {
              format = {};
          };
          typescript = {
              format = {};
          };
          emmet = {};
          stylusSupremacy = {};
        };
      };
    };
  };
}

configs[server_name].install = installer.install
configs[server_name].install_info = installer.info
-- vim:et ts=2 sw=2