From 4bc51c5128213126f04bc4f1ee1843a3747a8a6b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 26 Feb 2024 07:19:19 +0300 Subject: [PATCH] modules/assistant: completely drop tabnine --- modules/assistant/default.nix | 3 +- modules/assistant/tabnine/config.nix | 54 --------------------------- modules/assistant/tabnine/default.nix | 6 --- modules/assistant/tabnine/tabnine.nix | 30 --------------- 4 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 modules/assistant/tabnine/config.nix delete mode 100644 modules/assistant/tabnine/default.nix delete mode 100644 modules/assistant/tabnine/tabnine.nix diff --git a/modules/assistant/default.nix b/modules/assistant/default.nix index a8096c8..3521c52 100644 --- a/modules/assistant/default.nix +++ b/modules/assistant/default.nix @@ -1,6 +1,5 @@ -_: { +{ imports = [ ./copilot - # ./tabnine.nix # removed until I find a way around the initialisation script the plugin requires ]; } diff --git a/modules/assistant/tabnine/config.nix b/modules/assistant/tabnine/config.nix deleted file mode 100644 index e9cc209..0000000 --- a/modules/assistant/tabnine/config.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (builtins) toJSON; - inherit (lib) mkIf mkMerge mkExprBinding boolToString nvim; - - cfg = config.vim.assistant.tabnine; -in { - config = mkIf cfg.enable { - vim.startPlugins = ["tabnine-nvim"]; - - vim.maps.insert = mkMerge [ - (mkExprBinding cfg.mappings.accept '' - function() - local state = require("tabnine.state") - local completion = require("tabnine.completion") - - if not state.completions_cache then - return "${toJSON cfg.mappings.accept}" - end - - vim.schedule(completion.accept) - end - '' "orzel") - (mkExprBinding cfg.mappings.dismiss '' - function() - local state = require("tabnine.state") - local completion = require("tabnine.completion") - - if not state.completions_cache then - return "${toJSON cfg.mappings.dismiss}" - end - - vim.schedule(function() - completion.clear() - state.completions_cache = nil - end) - end - '' "orzel") - ]; - - vim.luaConfigRC.tabnine-nvim = nvim.dag.entryAnywhere '' - require('tabnine').setup({ - disable_auto_comment = ${boolToString cfg.disable_auto_comment}, - accept_keymap = null, - dismiss_keymap = null, - debounce_ms = ${cfg.debounce_ms}, - exclude_filetypes = ${cfg.exclude_filetypes}, - }) - ''; - }; -} diff --git a/modules/assistant/tabnine/default.nix b/modules/assistant/tabnine/default.nix deleted file mode 100644 index 84f3cf2..0000000 --- a/modules/assistant/tabnine/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - imports = [ - ./config.nix - ./tabnine.nix - ]; -} diff --git a/modules/assistant/tabnine/tabnine.nix b/modules/assistant/tabnine/tabnine.nix deleted file mode 100644 index 949a6b1..0000000 --- a/modules/assistant/tabnine/tabnine.nix +++ /dev/null @@ -1,30 +0,0 @@ -{lib, ...}: let - inherit (lib) mkEnableOption mkOption types mkMappingOption; -in { - options.vim.assistant.tabnine = { - enable = mkEnableOption "Tabnine assistant"; - - disable_auto_comment = mkOption { - type = types.bool; - default = true; - description = "Disable auto comment"; - }; - - mappings = { - accept = mkMappingOption "Accept [Tabnine]" ""; - dismiss = mkMappingOption "Dismiss [Tabnine]" ""; - }; - - debounce_ms = mkOption { - type = types.int; - default = 800; - description = "Debounce ms"; - }; - - exclude_filetypes = mkOption { - type = types.listOf types.str; - default = ["TelescopePrompt" "NvimTree" "alpha"]; - description = "Exclude filetypes"; - }; - }; -}