feat(lang): add OCaml (#4079)
## Description <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> Adds an extra that adds language support for ocaml. Adds LSP and completions. Fairly simple/small config. ## Related Issue(s) <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> None ## Screenshots <!-- Add screenshots of the changes if applicable. --> <img width="1510" alt="lsp ocaml" src="https://github.com/user-attachments/assets/0e44c539-332c-415d-9225-bcbb61f37666"> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
39
lua/lazyvim/plugins/extras/lang/ocaml.lua
Normal file
39
lua/lazyvim/plugins/extras/lang/ocaml.lua
Normal file
@ -0,0 +1,39 @@
|
||||
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 = {
|
||||
get_language_id = function(_, ftype)
|
||||
return language_id_of[ftype]
|
||||
end,
|
||||
root_dir = function(fname)
|
||||
return require("lspconfig.util").root_pattern(
|
||||
"*.opam",
|
||||
"esy.json",
|
||||
"package.json",
|
||||
".git",
|
||||
"dune-project",
|
||||
"dune-workspace",
|
||||
"*.ml"
|
||||
)(fname)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user