mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-22 02:59:49 +01:00
languages/ocaml: init
This commit is contained in:
parent
1fd4a2a1b8
commit
db810bbf9f
3 changed files with 61 additions and 0 deletions
|
@ -38,3 +38,7 @@ Release notes for release 0.7
|
||||||
|
|
||||||
- Cleaned up Lualine module to reduce theme dependency on Catppuccin, and fixed
|
- Cleaned up Lualine module to reduce theme dependency on Catppuccin, and fixed
|
||||||
blending issues in component separators.
|
blending issues in component separators.
|
||||||
|
|
||||||
|
[jacekpoz](https://github.com/jacekpoz):
|
||||||
|
|
||||||
|
- Added [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
|
||||||
|
|
|
@ -14,6 +14,7 @@ in {
|
||||||
./markdown.nix
|
./markdown.nix
|
||||||
./nim.nix
|
./nim.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
|
./ocaml.nix
|
||||||
./php.nix
|
./php.nix
|
||||||
./python.nix
|
./python.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
|
|
56
modules/plugins/languages/ocaml.nix
Normal file
56
modules/plugins/languages/ocaml.nix
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) either listOf package str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.ocaml;
|
||||||
|
in {
|
||||||
|
options.vim.languages.ocaml = {
|
||||||
|
enable = mkEnableOption "OCaml language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "OCaml treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "ocaml";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
package = mkOption {
|
||||||
|
description = "ocaml language server package, or the command to run as a list of strings";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = pkgs.ocamlPackages.ocaml-lsp;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.ocaml-lsp = ''
|
||||||
|
lspconfig.ocamllsp.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${getExe cfg.lsp.package}"}''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Reference in a new issue