From 8040f8422af26936e9c9a2c2d692cbcfb7f52c78 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 29 Aug 2023 07:40:57 +0200 Subject: [PATCH] plugins/treesitter-playground: mark as deprecated --- .../treesitter/treesitter-playground.nix | 83 ++++--------------- .../treesitter/treesitter-playground.nix | 29 ------- 2 files changed, 17 insertions(+), 95 deletions(-) delete mode 100644 tests/test-sources/plugins/languages/treesitter/treesitter-playground.nix diff --git a/plugins/languages/treesitter/treesitter-playground.nix b/plugins/languages/treesitter/treesitter-playground.nix index b9670c07..1c2d01f7 100644 --- a/plugins/languages/treesitter/treesitter-playground.nix +++ b/plugins/languages/treesitter/treesitter-playground.nix @@ -1,67 +1,18 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - helpers = import ../../helpers.nix {inherit lib;}; - - inherit (helpers) mkPackageOption mkCompositeOption; - inherit (helpers.defaultNullOpts) mkInt mkBool mkStr mkNullable; -in { - options.plugins.treesitter-playground = { - enable = mkEnableOption "nvim-treesitter-playground"; - - package = mkPackageOption "treesitter-playground" pkgs.vimPlugins.playground; - - disabledLanguages = mkNullable (types.listOf types.str) "[]" "A list of languages where this module should be disabled"; - - updateTime = mkInt 25 "Debounced time for highlighting nodes in the playground from source code"; - - persistQueries = mkBool false "Whether the query persists across vim sessions"; - - keybindings = mkCompositeOption "Keybindings inside the Playground" { - toggleQueryEditor = mkStr "o" "Toggle query editor"; - toggleHlGroups = mkStr "i" "Toggle highlight groups"; - toggleInjectedLanguages = mkStr "t" "Toggle injected languages"; - toggleAnonymousNodes = mkStr "a" "Toggle anonymous nodes"; - toggleLanguageDisplay = mkStr "I" "Toggle language display"; - focusLanguage = mkStr "f" "Focus language"; - unfocusLanguage = mkStr "F" "Unfocus language"; - update = mkStr "R" "Update"; - gotoNode = mkStr "" "Go to node"; - showHelp = mkStr "?" "Show help"; - }; - }; - - config = let - cfg = config.plugins.treesitter-playground; - in - mkIf cfg.enable { - warnings = mkIf (!config.plugins.treesitter.enable) [ - "Nixvim: treesitter-playground needs treesitter to function as intended" - ]; - - extraPlugins = [cfg.package]; - - plugins.treesitter.moduleConfig.playground = { - enable = true; - disable = cfg.disabledLanguages; - updatetime = cfg.updateTime; - persist_queries = cfg.persistQueries; - keybindings = helpers.ifNonNull' cfg.keybindings { - toggle_query_editor = cfg.keybindings.toggleQueryEditor; - toggle_hl_groups = cfg.keybindings.toggleHlGroups; - toggle_injected_languages = cfg.keybindings.toggleInjectedLanguages; - toggle_anonymous_nodes = cfg.keybindings.toggleAnonymousNodes; - toggle_language_display = cfg.keybindings.toggleLanguageDisplay; - focus_language = cfg.keybindings.focusLanguage; - unfocus_language = cfg.keybindings.unfocusLanguage; - inherit (cfg.keybindings) update; - goto_node = cfg.keybindings.gotoNode; - show_help = cfg.keybindings.showHelp; - }; - }; - }; +{lib, ...}: +with lib; { + # Deprecation notice added 2023/08/29 + # TODO: remove (along with this file) in early November 2023. + imports = [ + ( + mkRemovedOptionModule + ["plugins" "treesitter-playground"] + '' + The `treesitter-playground` plugin has been deprecated since the functionality is included in Neovim. + Use: + - `:Inspect` to show the highlight groups under the cursor + - `:InspectTree` to show the parsed syntax tree ("TSPlayground") + - `:PreviewQuery` to open the Query Editor (Nvim 0.10+) + '' + ) + ]; } diff --git a/tests/test-sources/plugins/languages/treesitter/treesitter-playground.nix b/tests/test-sources/plugins/languages/treesitter/treesitter-playground.nix deleted file mode 100644 index b9879c50..00000000 --- a/tests/test-sources/plugins/languages/treesitter/treesitter-playground.nix +++ /dev/null @@ -1,29 +0,0 @@ -{pkgs}: { - empty = { - plugins.treesitter.enable = true; - plugins.treesitter-playground.enable = true; - }; - - default = { - plugins.treesitter.enable = true; - plugins.treesitter-playground = { - enable = true; - - disabledLanguages = []; - updateTime = 25; - persistQueries = false; - keybindings = { - toggleQueryEditor = "o"; - toggleHlGroups = "i"; - toggleInjectedLanguages = "t"; - toggleAnonymousNodes = "a"; - toggleLanguageDisplay = "I"; - focusLanguage = "f"; - unfocusLanguage = "F"; - update = "R"; - gotoNode = ""; - showHelp = "?"; - }; - }; - }; -}