aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorFernando Garcia Borges <5019902+fgborges@users.noreply.github.com>2019-12-27 19:02:04 +0900
committerAshkan Kiani <ashkan.k.kiani@gmail.com>2019-12-27 02:02:04 -0800
commitee9e8727025b95558514f65ccaa6bdebdf6cb12b (patch)
tree810a41ef4e537cffefa1d914de24a57642f1eaff /lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar.gz
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar.bz2
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar.lz
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar.xz
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.tar.zst
nvim-lspconfig-ee9e8727025b95558514f65ccaa6bdebdf6cb12b.zip
Add ocamlls (#76)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim_lsp.lua1
-rw-r--r--lua/nvim_lsp/ocamlls.lua48
2 files changed, 49 insertions, 0 deletions
diff --git a/lua/nvim_lsp.lua b/lua/nvim_lsp.lua
index f09b3835..1a9b7b6e 100644
--- a/lua/nvim_lsp.lua
+++ b/lua/nvim_lsp.lua
@@ -21,6 +21,7 @@ require 'nvim_lsp/solargraph'
require 'nvim_lsp/sumneko_lua'
require 'nvim_lsp/texlab'
require 'nvim_lsp/tsserver'
+require 'nvim_lsp/ocamlls'
local M = {
util = require 'nvim_lsp/util';
diff --git a/lua/nvim_lsp/ocamlls.lua b/lua/nvim_lsp/ocamlls.lua
new file mode 100644
index 00000000..99b5697f
--- /dev/null
+++ b/lua/nvim_lsp/ocamlls.lua
@@ -0,0 +1,48 @@
+local skeleton = require 'nvim_lsp/skeleton'
+local util = require 'nvim_lsp/util'
+local lsp = vim.lsp
+
+local server_name = "ocamlls"
+local bin_name = "ocaml-language-server"
+
+local installer = util.npm_installer {
+ server_name = server_name;
+ packages = { "ocaml-language-server" };
+ binaries = { bin_name };
+}
+
+skeleton[server_name] = {
+ default_config = {
+ cmd = { bin_name, "--stdio" };
+ filetypes = { "ocaml", "reason" };
+ root_dir = util.root_pattern(".merlin", "package.json");
+ log_level = lsp.protocol.MessageType.Warning;
+ settings = {};
+ };
+ on_new_config = function(new_config)
+ local install_info = installer.info()
+ if install_info.is_installed then
+ if type(new_config.cmd) == 'table' then
+ new_config.cmd[1] = install_info.binaries[bin_name]
+ else
+ new_config.cmd = {install_info.binaries[bin_name]}
+ end
+ end
+ end;
+ docs = {
+ description = [[
+https://github.com/ocaml-lsp/ocaml-language-server
+
+`ocaml-language-server` can be installed via `:LspInstall ocamlls` or by yourself with `npm`
+```sh
+npm install -g ocaml-langauge-server
+```
+ ]];
+ default_config = {
+ root_dir = [[root_pattern(".merlin", "package.json")]];
+ };
+ };
+};
+skeleton[server_name].install = installer.install
+skeleton[server_name].install_info = installer.info
+-- vim:et ts=2 sw=2