From 6dcd9794b1819965eb4f3dca70a1eb3c463de3cf Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:20:43 +0300 Subject: [PATCH] fix(ocaml): get_language_id (#4327) ## 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](https://github.com/tjdevries/config.nvim/blob/9b790b90c1ac68cf7e60d6537baf9395523d6b01/lua/custom/plugins/lsp.lua#L108-L115) and [another one](https://github.com/nyinyithann/neovim-ocaml/blob/e31c0d61fd78a2d367bacfae2886629a2c7a88d7/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](https://github.com/neovim/nvim-lspconfig/blob/d4814330b207a4e05ba9515e453b0e87f20357ec/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. ## Related Issue(s) Closes #4326 ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/ocaml.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/ocaml.lua b/lua/lazyvim/plugins/extras/lang/ocaml.lua index d4485856..83f72a72 100644 --- a/lua/lazyvim/plugins/extras/lang/ocaml.lua +++ b/lua/lazyvim/plugins/extras/lang/ocaml.lua @@ -18,9 +18,14 @@ return { opts = { servers = { ocamllsp = { - get_language_id = function(_, ftype) - return language_id_of[ftype] - end, + filetypes = { + "ocaml", + "ocaml.menhir", + "ocaml.interface", + "ocaml.ocamllex", + "reason", + "dune", + }, root_dir = function(fname) return require("lspconfig.util").root_pattern( "*.opam",