I tried to configure nvim from https://github.com/nvim-lua/kickstart.nvim for a first time, but got issues with applying your repo using a README. Instructions say, that I should use Plug ... and provide a command for non-neo vim. Maybe we should add a specific snippet for Lua to enable it? I found something, it doesn't complain immediately but I'm not sure.
Also, I stuck with enabling ocaml-lsp-server from my local opam PATH. Google says, that Mason is bad for this and I have troubles to enable OCaml-lsp in any manner.
This is what I have so far:
diff --git a/init.lua b/init.lua
index 3a98da0..ead49a8 100644
--- a/init.lua
+++ b/init.lua
@@ -502,6 +502,13 @@ require('which-key').register {
require('mason').setup()
require('mason-lspconfig').setup()
+local vim = vim
+local Plug = vim.fn['plug#']
+
+vim.call('plug#begin')
+Plug('tjdevries/ocaml.nvim', { ['do'] = ':lua require("ocaml").update()'})
+vim.call('plug#end')
+
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
@@ -510,6 +517,7 @@ require('mason-lspconfig').setup()
--
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
+local util = require 'lspconfig.util'
local servers = {
-- clangd = {},
-- gopls = {},
@@ -518,6 +526,30 @@ local servers = {
-- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
+ -- https://github.com/neovim/nvim-lspconfig/blob/9619e53d3f99f0ca4ea3b88f5d97fce703131820/lua/lspconfig/server_configurations/ocamllsp.lua#L18
+ ocamllsp = {
+ cmd = { 'ocamllsp' },
+ filetypes = { 'ocaml', 'menhir', 'ocamlinterface', 'ocamllex', 'reason', 'dune' },
+ root_dir = util.root_pattern('*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace'),
+ get_language_id = function(_, ftype)
+ return ftype
+ end,
+ docs = {
+ description = [[
+https://github.com/ocaml/ocaml-lsp
+
+`ocaml-lsp` can be installed as described in [installation guide](https://github.com/ocaml/ocaml-lsp#installation).
+
+To install the lsp server in a particular opam switch:
+```sh
+opam install ocaml-lsp-server
+```
+ ]],
+ default_config = {
+ root_dir = [[root_pattern("*.opam", "esy.json", "package.json", ".git", "dune-project", "dune-workspace")]],
+ },
+ },
+ },
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
...
I tried to configure nvim from https://github.com/nvim-lua/kickstart.nvim for a first time, but got issues with applying your repo using a README. Instructions say, that I should use
Plug ...
and provide a command for non-neo vim. Maybe we should add a specific snippet for Lua to enable it? I found something, it doesn't complain immediately but I'm not sure.Also, I stuck with enabling ocaml-lsp-server from my local opam PATH. Google says, that Mason is bad for this and I have troubles to enable OCaml-lsp in any manner.
This is what I have so far: