Neovim version (nvim -v)
v0.11.5
Operating system/version
macOS Tahoe 26.1
Expected behaviour
Apply lsp formatter result
Actual behaviour
do nothing
Output of :checkhealth guard
==============================================================================
guard: 1 ⚠️
Executable check ~
- ✅ OK npx found
- ✅ OK stylua found
- ✅ OK gofumpt found
- ✅ OK shfmt found
- ✅ OK shellcheck found
- ✅ OK rustfmt found
- ✅ OK fish_indent found
- ⚠️ WARNING It seems that mason.nvim is installed,in which case checkhealth may be inaccurate. Please add your mason bin path to PATH to avoid potential issues.
Settings ~
- ✅ OK fmt_on_save: false
- ✅ OK lsp_as_default_formatter: true
- ✅ OK save_on_fmt: false
Tools registered for current buffer (bufnr 2) ~
- ✅ OK Current buffer has filetype toml:
- 1 formatter autocmds attached
- 0 linter autocmds attached
- formatters:
- {
fn = <function 1>
}
How to reproduce the issue
open a toml file
add taplo as lsp
:lua Guard fmt
I noticed the formatted code already generated but not applied success
|
vim.lsp.util.apply_text_edits = function(text_edits, _, offset_encoding) |
|
-- the target buffer must be buf, we apply it to our scratch buffer |
|
n_edits = n_edits - 1 |
|
vim.tbl_map(function(edit) |
|
edit.range.start.line = edit.range.start.line - line_offset |
|
edit.range['end'].line = edit.range['end'].line - line_offset |
|
end, text_edits) |
|
apply(text_edits, scratch, offset_encoding) |
|
if n_edits == 0 then |
|
vim.lsp.util.apply_text_edits = apply |
|
local lines = api.nvim_buf_get_lines(scratch, 0, -1, false) |
|
api.nvim_command('silent! bwipe! ' .. scratch) |
|
coroutine.resume(co, table.concat(lines, '\n')) |
|
end |
|
end |
After commenting out this code, formatter apply success
Are you sure this is a min repro?
Neovim version (nvim -v)
v0.11.5
Operating system/version
macOS Tahoe 26.1
Expected behaviour
Apply lsp formatter result
Actual behaviour
do nothing
Output of :checkhealth guard
How to reproduce the issue
open a toml file
add taplo as lsp
:lua Guard fmtI noticed the formatted code already generated but not applied success
guard.nvim/lua/guard/lsp.lua
Lines 23 to 37 in f0080b7
After commenting out this code, formatter apply success
Are you sure this is a min repro?
vim.opt.rtpand configuration themselves