summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-05-03 00:19:18 +0200
committerAlan Pearce2024-05-03 00:19:18 +0200
commitae74f7ae134193dc7f132fe1c6f5c1c27ed17bf3 (patch)
treec01ac91e1a9dd2685146fc63ce024847760c526e
parent1d9af3f92cd0ca23a2cd8465f54976d01b915104 (diff)
downloadnixfiles-ae74f7ae134193dc7f132fe1c6f5c1c27ed17bf3.tar.lz
nixfiles-ae74f7ae134193dc7f132fe1c6f5c1c27ed17bf3.tar.zst
nixfiles-ae74f7ae134193dc7f132fe1c6f5c1c27ed17bf3.zip
tabnine: update module and configuration
-rw-r--r--user/modules/tabnine.nix11
-rw-r--r--user/settings/tabnine.nix78
2 files changed, 50 insertions, 39 deletions
diff --git a/user/modules/tabnine.nix b/user/modules/tabnine.nix
index a702cf29..3eee4834 100644
--- a/user/modules/tabnine.nix
+++ b/user/modules/tabnine.nix
@@ -5,6 +5,7 @@
 }:
 with lib; let
   inherit (pkgs) stdenv;
+  tomlFormat = pkgs.formats.toml { };
   cfg = config.programs.tabnine;
   lspConfigFile = config:
     pkgs.runCommand "TabNine.toml"
@@ -52,7 +53,7 @@ in
     };
 
     lspConfig = mkOption {
-      type = types.attrs;
+      type = tomlFormat.type;
       default = { };
       description = ''
         LSP Server configuration written to
@@ -64,7 +65,7 @@ in
 
   config = mkIf cfg.enable {
     home.file."${cfg.configDir}/TabNine.toml" = {
-      source = lspConfigFile cfg.lspConfig;
+      source = (tomlFormat.generate "TabNine.toml" cfg.lspConfig);
     };
     home.file."${cfg.configDir}/tabnine_config.json" = {
       source = pkgs.writeText "tabnine_config.json" (builtins.toJSON cfg.config);
@@ -84,10 +85,10 @@ in
       epkgs.tabnine
     ];
     programs.emacs.extraConfig = ''
+      (defun my/override-tabnine-exe-path (&rest args)
+        "${pkgs.tabnine}/bin/TabNine")
       (with-eval-after-load 'tabnine
-        (advice-add 'tabnine--executable-path :around
-          (lambda (original-function &rest args)
-            "${pkgs.tabnine}/bin/TabNine")))
+        (advice-add 'tabnine--executable-path :override #'my/override-tabnine-exe-path))
     '';
   };
 }
diff --git a/user/settings/tabnine.nix b/user/settings/tabnine.nix
index 612303a4..377b8217 100644
--- a/user/settings/tabnine.nix
+++ b/user/settings/tabnine.nix
@@ -10,10 +10,36 @@
     config = {
       version = pkgs.tabnine.version;
 
-      hide_promotional_message = true;
+      api_base_url = null;
+      api_key = config.programs.tabnine.registrationKey;
       beta_enabled = "No";
-      ignore_all_lsp = false;
+      binary_update_interval_seconds = 365 * 24 * 3600;
+      cloud_whitelist = [ ];
       creation_time = "2020-12-28T21:42:35.732522096Z";
+      deep_completions_work_mode = "LocalOnly";
+      disable_auto_update = true;
+      disable_local_when_using_battery = false;
+      enable_power_saving_mode = false;
+      enable_telemetry = false;
+      force_local_hub = true;
+      generation = 0;
+      hide_deep_information_message = false;
+      hide_promotional_message = true;
+      hosted_deep_completions_enabled = "Disabled";
+      ignore_all_lsp = false;
+      inline_suggestions_mode = true;
+      line_suggestions = true;
+      local_enabled = "Yes";
+      local_indexing = null;
+      local_model_size = null;
+      num_of_suggestions = 5;
+      onboarding = {
+        model_type = null;
+        skipped_login = true;
+        completed = true;
+      };
+      rate_limit_amount = null;
+      rate_limit_interval_seconds = null;
       semantic_status = {
         css = "Enabled";
         dockerfile = "Enabled";
@@ -21,79 +47,63 @@
         haskell = "Enabled";
         html = "Enabled";
         javascript = "Enabled";
-        ruby = "Enabled";
         nix = "Enabled";
+        ruby = "Enabled";
         scss = "Enabled";
         typescript = "Enabled";
         yaml = "Enabled";
       };
-      disable_auto_update = true;
-      binary_update_interval_seconds = 365 * 24 * 3600;
-      deep_completions_work_mode = "LocalOnly";
-      hosted_deep_completions_enabled = "Disabled";
+      snippets_enabled_v2 = true;
       tabnine_cloud_certificate_domain = null;
       tabnine_cloud_host = null;
       tabnine_cloud_port = null;
-      cloud_whitelist = [ ];
-      api_key = null;
-      api_key_service_level = null;
-      api_base_url = null;
-      local_enabled = "Yes";
-      local_indexing = null;
-      local_model_size = null;
-      disable_local_when_using_battery = false;
-      hide_deep_information_message = false;
-      enable_power_saving_mode = false;
-      enable_telemetry = false;
-      generation = 0;
-      rate_limit_interval_seconds = null;
-      rate_limit_amount = null;
+      use_specialized_model_if_available = true;
     };
-    lspConfig = {
-      "language.typescript" = {
+    lspConfig.language = {
+      typescript = {
         command = "typescript-language-server";
         args = [ "--stdio" ];
       };
-      "language.javascript" = {
+      javascript = {
         command = "javascript-typescript-stdio";
         args = [ "--stdio" ];
       };
-      "language.css" = {
+      css = {
         command = "css-languageserver";
         args = [ "--stdio" ];
       };
-      "language.scss" = {
+      scss = {
         command = "css-languageserver";
         args = [ "--stdio" ];
       };
-      "language.html" = {
+      html = {
         command = "html-languageserver";
         args = [ "--stdio" ];
       };
-      "language.nix" = {
+      nix = {
         command = "nil";
         args = [ "--stdio" ];
       };
-      "language.dockerfile" = {
+      dockerfile = {
         command = "docker-langserver";
         args = [ "--stdio" ];
       };
-      "language.ruby" = {
+      ruby = {
         command = "solargraph";
         args = [ "stdio" ];
       };
-      "language.yaml" = {
+      yaml = {
         command = "yaml-language-server";
         args = [ "--stdio" ];
       };
-      "language.haskell" = {
+      haskell = {
         command = "hie";
         args = [ "--stdio" ];
       };
-      "language.go" = {
+      go = {
         command = "gopls";
         args = [
-          "server"
+          "serve"
         ];
       };
     };