Skip to content

Commit

Permalink
plugins/deprecation: add rust-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Oct 23, 2024
1 parent 876ca32 commit 029eafd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
39 changes: 27 additions & 12 deletions plugins/deprecation.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{ lib, ... }:
let
deprecated = {
# TODO: added 10-23-2024, move to removed after 24.11
"rust-tools" = ''
The `rust-tools` project has been abandoned.
It is recommended to use `rustaceanvim` instead.
'';
};
removed = {
# Added 2023-08-29
treesitter-playground = ''
Expand Down Expand Up @@ -64,22 +71,30 @@ in
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
) iconsPackagePlugins
# Show a warning when web-devicons is auto-enabled
++ [
(
{ config, options, ... }:
{
config = lib.mkIf (options.plugins.web-devicons.enable.highestPrio == 1490) {
warnings = [
''
Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled.
This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable` or alternatively
enable `plugins.mini.enable` with `plugins.mini.modules.icons` and `plugins.mini.mockDevIcons`.
${lib.concatMapStringsSep "\n" (name: "plugins.${name}") (
builtins.filter (name: config.plugins.${name}.enable) iconsPackagePlugins
)}
''
];
config = {
warnings =
lib.optionals (options.plugins.web-devicons.enable.highestPrio == 1490) [
''
Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled.
This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable` or alternatively
enable `plugins.mini.enable` with `plugins.mini.modules.icons` and `plugins.mini.mockDevIcons`.
${lib.concatMapStringsSep "\n" (name: "plugins.${name}") (
builtins.filter (name: config.plugins.${name}.enable) iconsPackagePlugins
)}
''
]
++ lib.foldlAttrs (
warnings: plugin: msg:
warnings
++ lib.optional config.plugins.${plugin}.enable ''
Nixvim Warning: The `${plugin}` plugin has been deprecated.
${msg}
''
) [ ] deprecated;
};
}
)
Expand Down
6 changes: 6 additions & 0 deletions tests/test-sources/plugins/by-name/rust-tools/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
empty = {
# Plugin deprecated
test.checkWarnings = false;
plugins.rust-tools.enable = true;
};

defaults = {
# Plugin deprecated
test.checkWarnings = false;
plugins.rust-tools = {
enable = true;
executor = "termopen";
Expand Down Expand Up @@ -73,6 +77,8 @@
};

rust-analyzer-options = {
# Plugin deprecated
test.checkWarnings = false;
plugins.rust-tools = {
enable = true;
server = {
Expand Down

0 comments on commit 029eafd

Please sign in to comment.