From 9142a5b9dd7dacf54825d2fcd730604457535ebc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 14 Jan 2025 16:01:56 +0300 Subject: [PATCH 1/5] docs: update contribution guidelines Update URL for nixpkgs flavoured markdown, add mkOption argument ordering --- docs/manual/hacking/guidelines.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/manual/hacking/guidelines.md b/docs/manual/hacking/guidelines.md index 882deea8..a1db27e8 100644 --- a/docs/manual/hacking/guidelines.md +++ b/docs/manual/hacking/guidelines.md @@ -14,14 +14,11 @@ necessarily) before you start developing. ## Adding Documentation {#sec-guidelines-documentation} -Most, if not all, changes warrant changes to the documentation. Module options -should be documented with -[Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup), -albeit with exceptions. +[Nixpkgs Flavoured Markdown]: https://github.com/NixOS/nixpkgs/blob/master/doc/README.md#syntax -::: {.note} As of **v0.5**, **nvf** is itself documented using full markdown in -both module options and the manual. With **v0.6**, this manual has also been -converted to markdown in full. ::: +Almost all changes warrant updates to the documentation: at the very least, you +must update the changelog. Both the manual and module options use +[Nixpkgs Flavoured Markdown]. The HTML version of this manual containing both the module option descriptions and the documentation of **nvf** (such as this page) can be generated and opened @@ -117,10 +114,11 @@ applies to string literals and module descriptions and documentation. ### Nix {#sec-code-style-nix} -**nvf** is formatted by the -[alejandra](https://github.com/kamadorueda/alejandra) tool and the formatting is -checked in the pull request and push workflows. Run the `nix fmt` command inside -the project repository before submitting your pull request. +[alejandra]: https://github.com/kamadorueda/alejandra + +**nvf** is formatted by the [alejandra] tool and the formatting is checked in +the pull request and push workflows. Run the `nix fmt` command inside the +project repository before submitting your pull request. While Alejandra is mostly opinionated on how code looks after formatting, certain changes are done at the user's discretion based on how the original code @@ -138,10 +136,14 @@ module = { # same as parent modules, unfold submodules subModule = { # this is an option that contains more than one nested value + # Note: try to be careful about the ordering of `mkOption` arguments. + # General rule of thumb is to order from least to most likely to change. + # This is, for most cases, type < default < description. + # Example, if present, would be between default and description someOtherValue = mkOption { type = lib.types.bool; - description = "Some other description"; default = true; + description = "Some other description"; }; }; } From dcb9b16f81f6b766e0219bbef58c207240d01c6f Mon Sep 17 00:00:00 2001 From: Thales Menato <8753631+thamenato@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:03:03 -0500 Subject: [PATCH 2/5] feat: add ruff to formatters --- modules/plugins/languages/python.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 61aedcee..876093c0 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -106,6 +106,18 @@ ) ''; }; + + ruff = { + package = pkgs.ruff; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.ruff.with({ + command = "${cfg.format.package}/bin/ruff", + }) + ) + ''; + }; }; defaultDebugger = "debugpy"; From ecf832681c79e9852b474cfa270c1f8d06891959 Mon Sep 17 00:00:00 2001 From: Thales Menato <8753631+thamenato@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:23:11 -0500 Subject: [PATCH 3/5] fix: ruff command feat: add ruff ruff --- modules/plugins/languages/python.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 876093c0..a36e174f 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -108,7 +108,13 @@ }; ruff = { - package = pkgs.ruff; + package = pkgs.writeShellApplication { + name = "ruff"; + runtimeInputs = [pkgs.ruff]; + text = '' + ruff format - + ''; + }; nullConfig = '' table.insert( ls_sources, From 3f43edd635f688a541fe230b7fcc38580a6bb6b1 Mon Sep 17 00:00:00 2001 From: Thales Menato <8753631+thamenato@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:24:04 -0500 Subject: [PATCH 4/5] fix: run nix fmt --- modules/plugins/languages/python.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index a36e174f..0a3c6c8a 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -109,7 +109,7 @@ ruff = { package = pkgs.writeShellApplication { - name = "ruff"; + name = "ruff"; runtimeInputs = [pkgs.ruff]; text = '' ruff format - From f6d249d0768b62bba332e1866f5b1ed4b7b46220 Mon Sep 17 00:00:00 2001 From: Thales Menato <8753631+thamenato@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:33:27 -0500 Subject: [PATCH 5/5] docs: update changelog --- docs/release-notes/rl-0.8.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index d15c6842..edb3e7b3 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -41,8 +41,8 @@ [horriblename](https://github.com/horriblename): -[aerial.nvim](https://github.com/stevearc/aerial.nvim) -[nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) +[aerial.nvim]: (https://github.com/stevearc/aerial.nvim) +[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo) - Add [aerial.nvim] - Add [nvim-ufo] @@ -52,7 +52,8 @@ - Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes issue with setting the workspace directory. - Add `vim.snippets.luasnip.setupOpts`, which was previously missing. -- Add `"prettierd"` as a formatter option in `vim.languages.markdown.format.type`. +- Add `"prettierd"` as a formatter option in + `vim.languages.markdown.format.type`. [kaktu5](https://github.com/kaktu5): @@ -63,3 +64,9 @@ [solargraph]: https://github.com/castwide/solargraph - Add Ruby support under `vim.languages.ruby` using [solargraph]. + +[thamenato](https://github.com/thamenato): + +[ruff]: (https://github.com/astral-sh/ruff) + +- Add [ruff] as a formatter option in `vim.languages.python.format.type`.