
## Description This fixes the error users get from local function `get_language_id`. From looking into [nvim-lspconfig ocamllsp](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/ocamllsp.lua) and other googling around, namely [tjdevries config files](9b790b90c1/lua/custom/plugins/lsp.lua (L108-L115)
) and [another one](e31c0d61fd/nvim/after/plugin/lspconfig.lua (L67)
), it seems that we can directly set these as filetypes foregoing the mapping via the additional local function which would also need the [nvim-lspconfig language_id mapping](d4814330b2/lua/lspconfig/server_configurations/ocamllsp.lua (L3-L10)
). Please bear in mind I don't do any Ocaml, so it would be great if other users who do Ocaml could test this PR. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) Closes #4326 <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
45 lines
1.0 KiB
Lua
45 lines
1.0 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
ft = { "ml", "mli", "cmi", "cmo", "cmx", "cma", "cmxa", "cmxs", "cmt", "cmti", "opam" },
|
|
root = { "merlin.opam", "dune-project" },
|
|
})
|
|
end,
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = function(_, opts)
|
|
if type(opts.ensure_installed) == "table" then
|
|
vim.list_extend(opts.ensure_installed, { "ocaml" })
|
|
end
|
|
end,
|
|
},
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = {
|
|
servers = {
|
|
ocamllsp = {
|
|
filetypes = {
|
|
"ocaml",
|
|
"ocaml.menhir",
|
|
"ocaml.interface",
|
|
"ocaml.ocamllex",
|
|
"reason",
|
|
"dune",
|
|
},
|
|
root_dir = function(fname)
|
|
return require("lspconfig.util").root_pattern(
|
|
"*.opam",
|
|
"esy.json",
|
|
"package.json",
|
|
".git",
|
|
"dune-project",
|
|
"dune-workspace",
|
|
"*.ml"
|
|
)(fname)
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|