From b2508f548649f875cf3e8d881afe27a246852f4c Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:34:30 -0300 Subject: [PATCH 1/6] chore: Update flake Updating package --- flake.lock | 35 +++++++++++++++++------------------ flake.nix | 27 ++++++++++++--------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/flake.lock b/flake.lock index d4cb3180..3955cf13 100644 --- a/flake.lock +++ b/flake.lock @@ -103,11 +103,11 @@ ] }, "locked": { - "lastModified": 1706955260, - "narHash": "sha256-W3y0j77IDVbmbajudHoUr46RpswujUCl+D5Vru53UsI=", + "lastModified": 1707467182, + "narHash": "sha256-/Bw/xgCXfj4nXDd8Xq+r1kaorfsYkkomMf5w5MpsDyA=", "owner": "nix-community", "repo": "home-manager", - "rev": "880d9bc2110f7cae59698f715b8ca42cdc53670c", + "rev": "5b9156fa9a8b8beba917b8f9adbfd27bf63e16af", "type": "github" }, "original": { @@ -139,12 +139,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707588924, - "narHash": "sha256-0e1ce6X5ghapv6cAF9rxLZKeNyFHHXsLbGxN2cQQE8U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "10b813040df67c4039086db0f6eaf65c536886c6", - "type": "github" + "lastModified": 1707268954, + "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", + "path": "/nix/store/snp5f95xhkz89kdw9703kana3m6xfd0a-source", + "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", + "type": "path" }, "original": { "id": "nixpkgs", @@ -153,11 +152,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1706732774, - "narHash": "sha256-hqJlyJk4MRpcItGYMF+3uHe8HvxNETWvlGtLuVpqLU0=", + "lastModified": 1707268954, + "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b8b232ae7b8b144397fdb12d20f592e5e7c1a64d", + "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", "type": "github" }, "original": { @@ -176,11 +175,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1707677596, - "narHash": "sha256-+xMTYbWXBu0Sek8rjKuXAL3mBLgTp1Bcwp4i1XRBJwo=", + "lastModified": 1707739963, + "narHash": "sha256-DpECm6j0fjOaBqcpVhmU76fCHbhEfROd9SjHuE2JvMk=", "owner": "nix-community", "repo": "nixvim", - "rev": "30bc345dee03d933af184f63056ab2ee9864d37f", + "rev": "3871b56b15857333d3c3f6d0e76fc1df51afe664", "type": "github" }, "original": { @@ -204,11 +203,11 @@ ] }, "locked": { - "lastModified": 1706424699, - "narHash": "sha256-Q3RBuOpZNH2eFA1e+IHgZLAOqDD9SKhJ/sszrL8bQD4=", + "lastModified": 1707297608, + "narHash": "sha256-ADjo/5VySGlvtCW3qR+vdFF4xM9kJFlRDqcC9ZGI8EA=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf", + "rev": "0db2e67ee49910adfa13010e7f012149660af7f0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6f0128e0..0f78ddab 100644 --- a/flake.nix +++ b/flake.nix @@ -6,20 +6,18 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = - { self - , nixpkgs - , nixvim - , flake-utils - , ... - } @ inputs: - let - config = import ./config; # import the module directly - in - flake-utils.lib.eachDefaultSystem (system: - let + outputs = { + self, + nixpkgs, + nixvim, + flake-utils, + ... + } @ inputs: let + config = import ./config; # import the module directly + in + flake-utils.lib.eachDefaultSystem (system: let nixvimLib = nixvim.lib.${system}; - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs {inherit system;}; nixvim' = nixvim.legacyPackages.${system}; nvim = nixvim'.makeNixvimWithModule { inherit pkgs; @@ -29,8 +27,7 @@ inherit self; }; }; - in - { + in { checks = { # Run `nix flake check .` to verify that your config is not broken default = nixvimLib.check.mkTestDerivationFromNvim { From c00e33e6c6d173061d457ca856117dda76072157 Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:34:55 -0300 Subject: [PATCH 2/6] fix: Typo for inlay hints toggle function --- config/keymaps.nix | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/config/keymaps.nix b/config/keymaps.nix index 83203ecc..64dd1bb7 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -517,13 +517,10 @@ end end - if vim.lsp.inlay_hint then - vim.keymap.set( - "n", - "uh", - function() vim.lsp.inlay_hiny(0, nil) end, - { desc = "Toggle inlay hints" } - ) - end + if vim.lsp.inlay_hint then + vim.keymap.set('n', 'uh', function() + vim.lsp.inlay_hint(0, nil) + end, { desc = 'Toggle Inlay Hints' }) + end ''; } From 8375700c74869ff7e1a2feb22082b0deac04495c Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:35:35 -0300 Subject: [PATCH 3/6] feat: Add inlay hints for lua_ls and typescript server Will only be available in Neovim v0.10 --- config/lsp/lsp.nix | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/config/lsp/lsp.nix b/config/lsp/lsp.nix index e4fa515a..4fe368e1 100644 --- a/config/lsp/lsp.nix +++ b/config/lsp/lsp.nix @@ -7,7 +7,7 @@ enable = true; capabilities = "offsetEncoding = 'utf-16'"; servers = { - clangd = { enable = true; }; + clangd = {enable = true;}; lua-ls = { enable = true; extraOptions = { @@ -19,18 +19,45 @@ telemetry = { enabled = false; }; + hint = {enable = true;}; }; }; }; }; - nil_ls = { enable = true; }; + nil_ls = {enable = true;}; tsserver = { enable = false; - filetypes = [ "javascript" "javascriptreact" "typescript" "typescriptreact" ]; + filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"]; + extraOptions = { + settings = { + javascript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + typescript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + }; + }; }; - eslint = { enable = true; }; - pyright = { enable = true; }; - ruff-lsp = { enable = true; }; + eslint = {enable = true;}; + pyright = {enable = true;}; + ruff-lsp = {enable = true;}; rust-analyzer = { enable = true; From 840219157b404d4ff5aa4de74cfed4e090301c08 Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:36:07 -0300 Subject: [PATCH 4/6] feat: Add inlay hints for typescript-tools Will only be available in Neovim v0.10 --- config/languages/typescript-tools-nvim.nix | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config/languages/typescript-tools-nvim.nix b/config/languages/typescript-tools-nvim.nix index 534e73c8..81340732 100644 --- a/config/languages/typescript-tools-nvim.nix +++ b/config/languages/typescript-tools-nvim.nix @@ -1,6 +1,29 @@ { plugins.typescript-tools = { enable = true; + onAttach = '' + function(client, bufnr) + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + + if vim.lsp.inlay_hint then + vim.lsp.inlay_hint(bufnr, true) + end + end + ''; + settings = { + tsserverFilePreferences = { + # Inlay Hints + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayVariableTypeHints = true; + includeInlayVariableTypeHintsWhenTypeMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayEnumMemberValueHints = true; + }; + }; }; keymaps = [ From 577a4096d73fa3d8fa94c5de58d697d2740b1c01 Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:41:03 -0300 Subject: [PATCH 5/6] feat: Add new options for which key Interesting options that are available, however it's still a work in progress. --- config/utils/whichkey.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/utils/whichkey.nix b/config/utils/whichkey.nix index f075fae4..3b018217 100644 --- a/config/utils/whichkey.nix +++ b/config/utils/whichkey.nix @@ -1,5 +1,19 @@ { + # TODO: Implement general mappings plugins.which-key = { enable = true; + ignoreMissing = false; + icons = { + breadcrumb = "ยป"; + group = "+"; + separator = "๎ฎŠ"; # โžœ + }; + # registrations = { + # "t" = "๎ž• Terminal"; + # }; + window = { + border = "none"; + winblend = 0; + }; }; } From 696da99dbafedac94225426ac9dde9a69dfe401f Mon Sep 17 00:00:00 2001 From: Redyf Date: Mon, 12 Feb 2024 13:46:17 -0300 Subject: [PATCH 6/6] feat: Switch to alejandra formatter Just testing for now --- .github/workflows/update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 53a83380..7629434a 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -17,7 +17,7 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable - name: Install Nix Linting and Formatting Tools - run: nix-env -i statix nixpkgs-fmt -f '' + run: nix-env -i statix alejandra -f '' - name: Flake update run: nix flake update