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 diff --git a/config/keymaps.nix b/config/keymaps.nix index 29fec466..782bf119 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 ''; } 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 = [ 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; 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; + }; }; } diff --git a/flake.lock b/flake.lock index c67ff637..3955cf13 100644 --- a/flake.lock +++ b/flake.lock @@ -139,12 +139,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707619277, - "narHash": "sha256-vKnYD5GMQbNQyyQm4wRlqi+5n0/F1hnvqSQgaBy4BqY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f3a93440fbfff8a74350f4791332a19282cc6dc8", - "type": "github" + "lastModified": 1707268954, + "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", + "path": "/nix/store/snp5f95xhkz89kdw9703kana3m6xfd0a-source", + "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", + "type": "path" }, "original": { "id": "nixpkgs", @@ -176,11 +175,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1707691286, - "narHash": "sha256-yZ8KzUBAo0xMk683krioF/YPr0StrN32kkDYArfrrOs=", + "lastModified": 1707739963, + "narHash": "sha256-DpECm6j0fjOaBqcpVhmU76fCHbhEfROd9SjHuE2JvMk=", "owner": "nix-community", "repo": "nixvim", - "rev": "f44d117d59117e55c4ddf1837e5eb65eeda2f135", + "rev": "3871b56b15857333d3c3f6d0e76fc1df51afe664", "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 {