Compare commits

..

11 commits

Author SHA1 Message Date
e2b3daa6f8
neovim/diagnostic: fix missin submodule opts
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
2025-04-05 06:21:50 +03:00
raf
0fc84ed868
Merge pull request #794 from venkyr77/inlay-hint-support
lsp: add inlayHints support
2025-04-05 01:59:51 +00:00
Venkatesan Ravi
a1fbdf49fd lsp: add inlayHints support 2025-04-05 01:39:01 +00:00
raf
939c7e98b4
Merge pull request #786 from NotAShelf/vim-diagnostics
neovim/diagnostics: init module
2025-04-05 01:15:59 +00:00
1a04f40e89
pins: remove lsp-lines 2025-04-05 03:54:25 +03:00
raf
751601c1db
Merge branch 'main' into vim-diagnostics 2025-04-04 22:34:42 +00:00
raf
d5a12efbcb
Merge pull request #793 from venkyr77/indentscope-fix
mini/indentscope: add autocmd to disable indentscope in applicable filetypes
2025-04-04 22:34:27 +00:00
Venkatesan Ravi
19339ac3cd mini/indentscope: add autocmd to disable indentscope in applicable filetypes 2025-04-04 22:31:36 +00:00
raf
963af1541e
Merge branch 'main' into vim-diagnostics 2025-04-04 13:47:24 +00:00
335a878a8f
lsp: deprecate lsplines in favor of vim.diagnostics 2025-04-04 14:35:16 +03:00
c5bc6d503e
neovim/diagnostics: init module 2025-04-04 14:35:13 +03:00
14 changed files with 174 additions and 61 deletions

View file

@ -25,7 +25,6 @@ isMaximal: {
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
otter-nvim.enable = isMaximal; otter-nvim.enable = isMaximal;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal; nvim-docs-view.enable = isMaximal;
}; };

View file

@ -87,6 +87,10 @@
- Add [oil.nvim] as an alternative file explorer. It will be available under - Add [oil.nvim] as an alternative file explorer. It will be available under
`vim.utility.oil-nvim`. `vim.utility.oil-nvim`.
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
options for `vim.diagnostic.config()` can now be customized through the
[](#opt-vim.diagnostics.config) in nvf.
[amadaluzia](https://github.com/amadaluzia): [amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
@ -253,8 +257,8 @@
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
blink.cmp can source snippets from it. blink.cmp can source snippets from it.
- Fix [blink.cmp] breaking when built-in sources were modified. - Fix [blink.cmp] breaking when built-in sources were modified.
- Fix [conform.nvim] not allowing disabling formatting on and after save. - Fix [conform.nvim] not allowing disabling formatting on and after save. Use
Use `null` value to disable them if conform is enabled. `null` value to disable them if conform is enabled.
[TheColorman](https://github.com/TheColorman): [TheColorman](https://github.com/TheColorman):
@ -295,6 +299,8 @@
- Add catppuccin integration for Bufferline, Lspsaga. - Add catppuccin integration for Bufferline, Lspsaga.
- Add neo-tree integration for Bufferline. - Add neo-tree integration for Bufferline.
- Add more applicable filetypes to illuminate denylist. - Add more applicable filetypes to illuminate denylist.
- Disable mini.indentscope for applicable filetypes.
- Enable inlay hints support - `config.vim.lsp.inlayHints`.
[tebuevd](https://github.com/tebuevd): [tebuevd](https://github.com/tebuevd):

View file

@ -104,6 +104,13 @@ in {
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC' their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
to replicate previous behaviour. to replicate previous behaviour.
'') '')
# 2025-04-04
(mkRemovedOptionModule ["vim" "lsp" "lsplines"] ''
lsplines module has been removed from nvf, as its functionality is now built into Neovim
under the diagnostics module. Please consider using one of 'vim.diagnostics.config' or
'vim.luaConfigRC' to configure LSP lines for Neovim through its own diagnostics API.
'')
] ]
# Migrated via batchRenameOptions. Further batch renames must be below this line. # Migrated via batchRenameOptions. Further batch renames must be below this line.

View file

@ -3,6 +3,7 @@
./autocmds.nix ./autocmds.nix
./basic.nix ./basic.nix
./debug.nix ./debug.nix
./diagnostics.nix
./highlight.nix ./highlight.nix
./spellcheck.nix ./spellcheck.nix
]; ];

View file

@ -0,0 +1,109 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrsOf anything oneOf bool submodule;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.types) luaInline;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.diagnostics;
# Takes a boolean, a table, or a Lua list ({key = value}). We
# would like to allow all of those types, while clearly expressing
# them in the option's type. As such, this type is what it is.
diagnosticType = oneOf [(attrsOf anything) bool luaInline];
diagnosticsSubmodule = submodule {
# The table might need to be extended, so let's allow that case
# with a freeform type of what is supported by diagnostics opts.
freeformType = attrsOf diagnosticType;
options = {
underline = mkOption {
type = diagnosticType;
default = true;
description = "Use underline for diagnostics.";
};
virtual_text = mkOption {
type = diagnosticType;
default = false;
example = literalExpression ''
{
format = lib.generators.mkLuaInline '''
function(diagnostic)
return string.format("%s (%s)", diagnostic.message, diagnostic.source)
end
''';
}
'';
description = ''
Use virtual text for diagnostics. If multiple diagnostics are set for a namespace,
one prefix per diagnostic + the last diagnostic message are shown.
'';
};
virtual_lines = mkOption {
type = diagnosticType;
default = false;
description = ''
Use virtual lines for diagnostics.
'';
};
signs = mkOption {
type = diagnosticType;
default = false;
example = {
signs.text = {
"vim.diagnostic.severity.ERROR" = "󰅚 ";
"vim.diagnostic.severity.WARN" = "󰀪 ";
};
};
description = ''
Use signs for diagnostics. See {command}`:help diagnostic-signs`.
'';
};
update_in_insert = mkOption {
type = bool;
default = false;
description = ''
Update diagnostics in Insert mode. If `false`, diagnostics will
be updated on InsertLeave ({command}`:help InsertLeave`).
'';
};
};
};
in {
options.vim = {
diagnostics = {
enable = mkEnableOption "diagostics module for Neovim";
config = mkOption {
type = diagnosticsSubmodule;
default = {};
description = ''
Values that will be passed to `vim.diagnostic.config` after being converted
to a Lua table. Possible values for each key can be found in the help text
for `vim.diagnostics.Opts`. You may find more about the diagnostics API of
Neovim in {command}`:help diagnostic-api`.
:::{.note}
This option is freeform. You may set values that are not present in nvf
documentation, but those values will not be fully type checked. Please
refer to the help text for `vim.diagnostic.Opts` for appropriate values.
:::
'';
};
};
};
config.vim = mkIf cfg.enable {
luaConfigRC.diagnostics = entryAfter ["basic"] ''
vim.diagnostic.config(${toLuaObject cfg.config})
'';
};
}

View file

@ -4,6 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib.generators) mkLuaInline;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString; inherit (lib.trivial) boolToString;
@ -28,6 +29,25 @@ in {
sourcePlugins = ["cmp-nvim-lsp"]; sourcePlugins = ["cmp-nvim-lsp"];
}; };
autocmds =
if cfg.inlayHints.enable
then [
{
callback = mkLuaInline ''
function(event)
local bufnr = event.buf
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
end
end
'';
desc = "LSP on-attach enable inlay hints autocmd";
event = ["LspAttach"];
}
]
else [];
pluginRC.lsp-setup = '' pluginRC.lsp-setup = ''
vim.g.formatsave = ${boolToString cfg.formatOnSave}; vim.g.formatsave = ${boolToString cfg.formatOnSave};

View file

@ -15,7 +15,6 @@
./lightbulb ./lightbulb
./otter ./otter
./lspkind ./lspkind
./lsplines
./nvim-docs-view ./nvim-docs-view
]; ];
} }

View file

@ -1,21 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lsplines.enable) {
vim.startPlugins = ["lsp-lines"];
vim.pluginRC.lsplines = entryAfter ["lspconfig"] ''
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false,
})
'';
};
}

View file

@ -1,6 +0,0 @@
{
imports = [
./config.nix
./lsplines.nix
];
}

View file

@ -1,11 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.lsp = {
lsplines = {
enable = mkEnableOption ''
diagnostics using virtual lines on top of the real line of code. [lsp_lines]
'';
};
};
}

View file

@ -5,6 +5,9 @@ in {
options.vim.lsp = { options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
formatOnSave = mkEnableOption "format on save"; formatOnSave = mkEnableOption "format on save";
inlayHints = {
enable = mkEnableOption "inlay hints";
};
mappings = { mappings = {
goToDefinition = goToDefinition =
mkMappingOption "Go to definition" mkMappingOption "Go to definition"

View file

@ -3,6 +3,7 @@
lib, lib,
... ...
}: let }: let
inherit (lib.generators) mkLuaInline;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
@ -10,6 +11,21 @@
cfg = config.vim.mini.indentscope; cfg = config.vim.mini.indentscope;
in { in {
vim = mkIf cfg.enable { vim = mkIf cfg.enable {
autocmds = [
{
callback = mkLuaInline ''
function()
local ignore_filetypes = ${toLuaObject cfg.setupOpts.ignore_filetypes}
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
vim.b.miniindentscope_disable = true
end
end
'';
desc = "Disable indentscope for certain filetypes";
event = ["FileType"];
}
];
startPlugins = ["mini-indentscope"]; startPlugins = ["mini-indentscope"];
pluginRC.mini-indentscope = entryAnywhere '' pluginRC.mini-indentscope = entryAnywhere ''

View file

@ -1,13 +1,16 @@
{ {lib, ...}: let
config, inherit (lib.options) mkOption mkEnableOption;
lib,
...
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption; inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.types) str listOf;
in { in {
options.vim.mini.indentscope = { options.vim.mini.indentscope = {
enable = mkEnableOption "mini.indentscope"; enable = mkEnableOption "mini.indentscope";
setupOpts = mkPluginSetupOption "mini.indentscope" {}; setupOpts = mkPluginSetupOption "mini.indentscope" {
ignore_filetypes = mkOption {
type = listOf str;
default = ["help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
description = "File types to ignore for illuminate";
};
};
}; };
} }

View file

@ -747,18 +747,6 @@
"url": "https://github.com/kawre/leetcode.nvim/archive/db7e1cd6b9191b34b4c1f2f96e4e3949cde9f951.tar.gz", "url": "https://github.com/kawre/leetcode.nvim/archive/db7e1cd6b9191b34b4c1f2f96e4e3949cde9f951.tar.gz",
"hash": "1d3lb7625b2qdzqm74mzrac66rxqc0qgjd3mb37l4v8wqyiyv6pp" "hash": "1d3lb7625b2qdzqm74mzrac66rxqc0qgjd3mb37l4v8wqyiyv6pp"
}, },
"lsp-lines": {
"type": "Git",
"repository": {
"type": "Git",
"url": "https://git.sr.ht/~whynothugo/lsp_lines.nvim"
},
"branch": "main",
"submodules": false,
"revision": "a92c755f182b89ea91bd8a6a2227208026f27b4d",
"url": null,
"hash": "14ym4d8vgvw2vhsaxik8612wyvszd895q69n9h100yd7x5jqhy4c"
},
"lsp-signature-nvim": { "lsp-signature-nvim": {
"type": "Git", "type": "Git",
"repository": { "repository": {