modules/assistant: completely drop tabnine

This commit is contained in:
raf 2024-02-26 07:19:19 +03:00
parent 54a6e28e18
commit 4bc51c5128
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 1 additions and 92 deletions

View file

@ -1,6 +1,5 @@
_: {
{
imports = [
./copilot
# ./tabnine.nix # removed until I find a way around the initialisation script the plugin requires
];
}

View file

@ -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},
})
'';
};
}

View file

@ -1,6 +0,0 @@
_: {
imports = [
./config.nix
./tabnine.nix
];
}

View file

@ -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]" "<Tab>";
dismiss = mkMappingOption "Dismiss [Tabnine]" "<C-]>";
};
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";
};
};
}