This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/plugins/lsp/default.nix

51 lines
1.4 KiB
Nix

{ lib
, plugins
, nvim-lspconfig
, nlsp-settings-nvim
, lspsaga-nvim
, luasnip
, nvim-cmp
, cmp-nvim-lsp
, cmp-luasnip
, cmp-tabby
, ...
}:
let
tabbymlEnable = lib.attrByPath [ "tabbyml" "enable" ] false plugins;
tabbymlDefaultSettings = {
host = "http://127.0.0.1:8080";
max_lines = 100;
};
tabbymlSettings = lib.toLua (lib.attrByPath [ "tabbyml" "settings" ] tabbymlDefaultSettings plugins);
tabbymlLuaConfig = lib.optional tabbymlEnable
(lib.readSubFile ./cmp-tabby.lua { inherit tabbymlSettings; });
cmpSources = lib.toLua ([
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "orgmode"; }
] ++ lib.optional tabbymlEnable [{ name = "cmp_tabby"; }]);
cmpLuaConfig = lib.readSubFile ./nvim-cmp.lua { inherit cmpSources; };
lspconfigLuaConfig = lib.readSubFile ./lspconfig.lua
{ inherit lspConfigServers lspSagaSettings; };
lsp = [ nvim-lspconfig nlsp-settings-nvim lspsaga-nvim ];
snippets = [ luasnip ];
completions = [
nvim-cmp # Autocompletion
cmp-nvim-lsp # LSP source for nvim-cmp
cmp-luasnip # Snippets source for nvim-cmp
] ++ lib.optional tabbymlEnable [ cmp-tabby ];
lspConfigServers = lib.toLua (lib.attrByPath [ "lspConfig" "servers" ] [ ] plugins);
lspSagaSettings = lib.toLua (lib.attrByPath [ "lspSaga" "settings" ] { } plugins);
in
{
luaConfig = lspconfigLuaConfig + tabbymlLuaConfig + cmpLuaConfig;
plugins = lsp
++ snippets
++ completions;
}