From ea7469f1c8ea990d49fcd1edf7d5b4bde02c397b Mon Sep 17 00:00:00 2001 From: orangci Date: Mon, 18 Nov 2024 11:10:20 +0300 Subject: [PATCH 1/6] docs: fix a typo in installation instructions --- docs/manual/installation/standalone/home-manager.md | 2 +- docs/manual/installation/standalone/nixos.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/manual/installation/standalone/home-manager.md b/docs/manual/installation/standalone/home-manager.md index db1ae632..1f5d55ce 100644 --- a/docs/manual/installation/standalone/home-manager.md +++ b/docs/manual/installation/standalone/home-manager.md @@ -1,6 +1,6 @@ # Standalone Installation on Home-Manager {#ch-standalone-hm} -Your built Neoevim configuration can be exposed as a flake output to make it +Your built Neovim configuration can be exposed as a flake output to make it easier to share across machines, repositories and so on. Or it can be added to your system packages to make it available across your system. diff --git a/docs/manual/installation/standalone/nixos.md b/docs/manual/installation/standalone/nixos.md index 2e6343a1..33235ac7 100644 --- a/docs/manual/installation/standalone/nixos.md +++ b/docs/manual/installation/standalone/nixos.md @@ -1,6 +1,6 @@ # Standalone Installation on NixOS {#ch-standalone-nixos} -Your built Neoevim configuration can be exposed as a flake output to make it +Your built Neovim configuration can be exposed as a flake output to make it easier to share across machines, repositories and so on. Or it can be added to your system packages to make it available across your system. From 88834cc93fa543e7b2cd3cf49b72870bc6544197 Mon Sep 17 00:00:00 2001 From: diniamo Date: Tue, 3 Dec 2024 16:28:31 +0100 Subject: [PATCH 2/6] run-nvim: fix keymaps --- modules/plugins/runner/run-nvim/config.nix | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/plugins/runner/run-nvim/config.nix b/modules/plugins/runner/run-nvim/config.nix index 70cd5c9f..7667f5d0 100644 --- a/modules/plugins/runner/run-nvim/config.nix +++ b/modules/plugins/runner/run-nvim/config.nix @@ -5,11 +5,10 @@ ... }: let inherit (lib.modules) mkIf mkDefault; - inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding mkSetLuaLznBinding; + inherit (lib.nvim.binds) mkKeymap; cfg = config.vim.runner.run-nvim; - mappingDefinitions = options.vim.runner.run-nvim.mappings; - mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; + inherit (options.vim.runner.run-nvim) mappings; in { config = mkIf cfg.enable { vim = { @@ -21,14 +20,17 @@ in { cmd = "Run"; keys = [ - (mkSetLznBinding "n" mappings.run "Run") - (mkSetLznBinding "n" mappings.runOverride "Run!") - (mkSetLuaLznBinding "n" mappings.runCommand '' - function() - local input = vim.fn.input("Run command: ") - if input ~= "" then require("run").run(input, false) end - end - '') + (mkKeymap "n" cfg.mappings.run "Run" {desc = mappings.run.description;}) + (mkKeymap "n" cfg.mappings.runOverride "Run!" {desc = mappings.runOverride.description;}) + (mkKeymap "n" cfg.mappings.runCommand '' + function() + local input = vim.fn.input("Run command: ") + if input ~= "" then require("run").run(input, false) end + end + '' { + desc = mappings.run.description; + lua = true; + }) ]; }; From fd4df3432e4c809adeef81bb3eada1b0a34dafa5 Mon Sep 17 00:00:00 2001 From: DamitusThyYeetus123 <108782125+DamitusThyYeetus123@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:13:56 +1100 Subject: [PATCH 3/6] languages/astro: init (#481) * LSP: Add astro * LSP: Properly add astro * LSP: Properly actually add astro * Flake: Fix mnw * Update flake/develop.nix Co-authored-by: raf * Update configuration.nix Co-authored-by: raf * Update astro.nix * Update rl-0.7.md --------- Co-authored-by: raf --- configuration.nix | 1 + docs/release-notes/rl-0.7.md | 4 + flake.lock | 6 +- modules/plugins/languages/astro.nix | 159 ++++++++++++++++++++++++++ modules/plugins/languages/default.nix | 1 + 5 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 modules/plugins/languages/astro.nix diff --git a/configuration.nix b/configuration.nix index 3b8e3d25..723070a7 100644 --- a/configuration.nix +++ b/configuration.nix @@ -48,6 +48,7 @@ isMaximal: { # Assembly is not common, and the asm LSP is a major hit-or-miss assembly.enable = false; + astro.enable = false; markdown.enable = isMaximal; html.enable = isMaximal; css.enable = isMaximal; diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 4b778a0f..6d6a83c5 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -383,3 +383,7 @@ The changes are, in no particular order: [Nowaaru](https://github.com/Nowaaru): - Add `precognition-nvim`. + +[DamitusThyYeeticus123](https://github.com/DamitusThyYeetus123): + +- Add support for [Astro](https://astro.build/) language server. diff --git a/flake.lock b/flake.lock index f05da25d..e84beb3a 100644 --- a/flake.lock +++ b/flake.lock @@ -38,11 +38,11 @@ }, "mnw": { "locked": { - "lastModified": 1733021555, - "narHash": "sha256-bc+reHXXfdn94MnDsqBrNm2ojOnJfbd64e00nzsP0EI=", + "lastModified": 1731821965, + "narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=", "owner": "Gerg-L", "repo": "mnw", - "rev": "6841d93fe50eb335da45e11d4dabaa1844f3f79a", + "rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e", "type": "github" }, "original": { diff --git a/modules/plugins/languages/astro.nix b/modules/plugins/languages/astro.nix new file mode 100644 index 00000000..9e70424b --- /dev/null +++ b/modules/plugins/languages/astro.nix @@ -0,0 +1,159 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.meta) getExe; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.languages) diagnosticsToLua; + inherit (lib.nvim.types) mkGrammarOption diagnostics; + + cfg = config.vim.languages.astro; + + defaultServer = "astro"; + servers = { + astro = { + package = pkgs.astro-language-server; + lspConfig = '' + lspconfig.astro.setup { + capabilities = capabilities; + on_attach = attach_keymaps, + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/astro-ls", "--stdio"}'' + } + } + ''; + }; + }; + + # TODO: specify packages + defaultFormat = "prettier"; + formats = { + prettier = { + package = pkgs.nodePackages.prettier; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.prettier.with({ + command = "${cfg.format.package}/bin/prettier", + }) + ) + ''; + }; + + biome = { + package = pkgs.biome; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.biome.with({ + command = "${cfg.format.package}/bin/biome", + }) + ) + ''; + }; + }; + + # TODO: specify packages + defaultDiagnosticsProvider = ["eslint_d"]; + diagnosticsProviders = { + eslint_d = { + package = pkgs.eslint_d; + nullConfig = pkg: '' + table.insert( + ls_sources, + null_ls.builtins.diagnostics.eslint_d.with({ + command = "${getExe pkg}", + }) + ) + ''; + }; + }; +in { + options.vim.languages.astro = { + enable = mkEnableOption "Astro language support"; + + treesitter = { + enable = mkEnableOption "Astro treesitter" // {default = config.vim.languages.enableTreesitter;}; + + astroPackage = mkGrammarOption pkgs "astro"; + }; + + lsp = { + enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;}; + + server = mkOption { + description = "Astro LSP server to use"; + type = enum (attrNames servers); + default = defaultServer; + }; + + package = mkOption { + description = "Astro LSP server package, or the command to run as a list of strings"; + example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]''; + type = either package (listOf str); + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkEnableOption "Astro formatting" // {default = config.vim.languages.enableFormat;}; + + type = mkOption { + description = "Astro formatter to use"; + type = enum (attrNames formats); + default = defaultFormat; + }; + + package = mkOption { + description = "Astro formatter package"; + type = package; + default = formats.${cfg.format.type}.package; + }; + }; + + extraDiagnostics = { + enable = mkEnableOption "extra Astro diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; + + types = diagnostics { + langDesc = "Astro"; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.astroPackage]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.astro-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources = diagnosticsToLua { + lang = "astro"; + config = cfg.extraDiagnostics.types; + inherit diagnosticsProviders; + }; + }) + ]); +} diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index 58662354..97b00910 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -3,6 +3,7 @@ in { imports = [ ./asm.nix + ./astro.nix ./bash.nix ./dart.nix ./clang.nix From 18bf52e540c745deb2c50fe3967cbe229a70bfe4 Mon Sep 17 00:00:00 2001 From: Soliprem <73885403+Soliprem@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:43:16 +0100 Subject: [PATCH 4/6] languages/gleam: init (#482) * modules/gleam: init * gleam: not using formatter * configuration: gleam set to false * docs: added changelog entry for gleam * gleam: fixed lsp and treesitter * gleam: capitalisation --- configuration.nix | 1 + docs/release-notes/rl-0.7.md | 1 + modules/plugins/languages/default.nix | 1 + modules/plugins/languages/gleam.nix | 71 +++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 modules/plugins/languages/gleam.nix diff --git a/configuration.nix b/configuration.nix index 723070a7..aadd1f83 100644 --- a/configuration.nix +++ b/configuration.nix @@ -65,6 +65,7 @@ isMaximal: { python.enable = isMaximal; dart.enable = isMaximal; bash.enable = isMaximal; + gleam.enable = false; r.enable = isMaximal; tailwind.enable = isMaximal; typst.enable = isMaximal; diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 6d6a83c5..59267ddf 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -359,6 +359,7 @@ The changes are, in no particular order: - Add LSP and Treesitter support for Assembly under `vim.languages.assembly` - Move [which-key](https://github.com/folke/which-key.nvim) to the new spec - Add LSP and Treesitter support for Nushell under `vim.languages.nu` +- Add LSP and Treesitter support for Gleam under `vim.languages.gleam` [Bloxx12](https://github.com/Bloxx12) diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index 97b00910..a69d3e8d 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -9,6 +9,7 @@ in { ./clang.nix ./css.nix ./elixir.nix + ./gleam.nix ./go.nix ./hcl.nix ./kotlin.nix diff --git a/modules/plugins/languages/gleam.nix b/modules/plugins/languages/gleam.nix new file mode 100644 index 00000000..284d3443 --- /dev/null +++ b/modules/plugins/languages/gleam.nix @@ -0,0 +1,71 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption; + + cfg = config.vim.languages.gleam; + + defaultServer = "gleam"; + servers = { + gleam = { + package = pkgs.gleam; + lspConfig = '' + lspconfig.gleam.setup{ + capabilities = capabilities, + on_attach = default_on_attach, + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/gleam", "lsp"}'' + } + } + ''; + }; + }; +in { + options.vim.languages.gleam = { + enable = mkEnableOption "Gleam language support"; + + treesitter = { + enable = mkEnableOption "Gleam treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "gleam"; + }; + + lsp = { + enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;}; + + server = mkOption { + type = enum (attrNames servers); + default = defaultServer; + description = "Gleam LSP server to use"; + }; + + package = mkOption { + type = either package (listOf str); + default = servers.${cfg.lsp.server}.package; + description = "Gleam LSP server package, or the command to run as a list of strings"; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.gleam-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} From 94d1a26b1c7bb24bdef059f4d02ed338dd5bfbf4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 4 Dec 2024 17:12:12 +0300 Subject: [PATCH 5/6] meta: mark as release --- release.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.json b/release.json index ce66d3ef..28c5eb7f 100644 --- a/release.json +++ b/release.json @@ -1,4 +1,4 @@ { "release": "v0.7", - "isReleaseBranch": false + "isReleaseBranch": true } From 66d0a8120625474020f5106c436595d226f412b9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 4 Dec 2024 17:46:33 +0300 Subject: [PATCH 6/6] docs: github pages compat --- docs/manual.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/manual.nix b/docs/manual.nix index 531a6d4e..113fb789 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -95,9 +95,9 @@ in nixos-render-docs manual html \ --manpage-urls ${path + "/doc/manpage-urls.json"} \ --revision ${lib.trivial.revisionWithDefault manual-release} \ - --stylesheet "$dest"/style.css \ - --script ./highlightjs/highlight.pack.js \ - --script ./highlightjs/loader.js \ + --stylesheet style.css \ + --script highlightjs/highlight.pack.js \ + --script highlightjs/loader.js \ --script script/anchor-use.js \ --script script/anchor-min.js \ --toc-depth 2 \