From 3e5fc2f93d7c6d2dd8e0195efd2c7369d1375b25 Mon Sep 17 00:00:00 2001 From: FKouhai Date: Sat, 31 May 2025 12:05:48 +0200 Subject: [PATCH] plugins/yaml-schema-detect: init --- .../by-name/yaml-schema-detect/default.nix | 29 +++++++++++++++++++ .../by-name/yaml-schema-detect/default.nix | 8 +++++ 2 files changed, 37 insertions(+) create mode 100644 plugins/by-name/yaml-schema-detect/default.nix create mode 100644 tests/test-sources/plugins/by-name/yaml-schema-detect/default.nix diff --git a/plugins/by-name/yaml-schema-detect/default.nix b/plugins/by-name/yaml-schema-detect/default.nix new file mode 100644 index 00000000..48555e9a --- /dev/null +++ b/plugins/by-name/yaml-schema-detect/default.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + options, + ... +}: +lib.nixvim.plugins.mkNeovimPlugin { + name = "yaml-schema-detect"; + packPathName = "yaml-schema-detect.nvim"; + package = "yaml-schema-detect-nvim"; + + description = '' + A Neovim plugin that automatically detects and applies YAML schemas for your YAML files using yaml-language-server (yamlls) + ''; + + extraConfig = cfg: { + warnings = lib.nixvim.mkWarnings "plugins.yaml-schema-detect" [ + { + when = !config.plugins.which-key.enable; + message = '' + This plugin requires `plugins.which-key` to be enabled + ${options.plugins.which-key.enable} = true; + ''; + } + ]; + }; + + maintainers = [ lib.maintainers.FKouhai ]; +} diff --git a/tests/test-sources/plugins/by-name/yaml-schema-detect/default.nix b/tests/test-sources/plugins/by-name/yaml-schema-detect/default.nix new file mode 100644 index 00000000..86593c6b --- /dev/null +++ b/tests/test-sources/plugins/by-name/yaml-schema-detect/default.nix @@ -0,0 +1,8 @@ +{ + # empty test case is not needed since having it would make the warning throw an error + # this plugin requires which-key + combine-plugins = { + plugins.which-key.enable = true; + plugins.yaml-schema-detect.enable = true; + }; +}