From 637f749d4cd82da37ec175c1d4aff8c74867ca77 Mon Sep 17 00:00:00 2001 From: Artur Manuel Date: Sat, 21 Dec 2024 14:08:17 +0000 Subject: [PATCH] languages/solidity: init solidity module --- configuration.nix | 1 + docs/release-notes/rl-0.8.md | 1 + modules/plugins/languages/default.nix | 1 + modules/plugins/languages/haskell.nix | 2 +- modules/plugins/languages/solidity.nix | 29 ++++++++++++++++++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 modules/plugins/languages/solidity.nix diff --git a/configuration.nix b/configuration.nix index 3be1d39b..7e403d54 100644 --- a/configuration.nix +++ b/configuration.nix @@ -74,6 +74,7 @@ isMaximal: { julia.enable = false; vala.enable = false; scala.enable = false; + solidity.enable = false; r.enable = false; gleam.enable = false; dart.enable = false; diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 03d4d010..60c71270 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -14,6 +14,7 @@ [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim - Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim]. +- Add Solidity support under `vim.languages.solidity`. [diniamo](https://github.com/diniamo): diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index ee9f55e1..5afbf364 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -27,6 +27,7 @@ in { ./r.nix ./rust.nix ./scala.nix + ./solidity.nix ./sql.nix ./svelte.nix ./tailwind.nix diff --git a/modules/plugins/languages/haskell.nix b/modules/plugins/languages/haskell.nix index 62f4cd41..ff6c7d78 100644 --- a/modules/plugins/languages/haskell.nix +++ b/modules/plugins/languages/haskell.nix @@ -71,7 +71,7 @@ in { cmd = ${ if isList cfg.lsp.package then expToLua cfg.lsp.package - else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}'' + else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper", "--lsp"}'' }, on_attach = function(client, bufnr, ht) default_on_attach(client, bufnr, ht) diff --git a/modules/plugins/languages/solidity.nix b/modules/plugins/languages/solidity.nix new file mode 100644 index 00000000..9eee5486 --- /dev/null +++ b/modules/plugins/languages/solidity.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.vim.languages.solidity; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim) mkGrammarOption; +in { + options.vim.languages.solidity = { + enable = mkEnableOption "Solidity support"; + + treesitter = { + enable = mkEnableOption "Treesitter support for Solidity"; + package = mkGrammarOption pkgs "solidity"; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (lib.mkIf cfg.treesitter.enable { + vim.treesitter = { + enable = true; + grammars = [cfg.treesitter.package]; + }; + }) + ]); +}