Neovim version (nvim -v)
NVIM v0.11.0 Build type: Release LuaJIT 2.1.1744318430
Operating system/version
MacOS Sonoma 14.5
Expected behaviour
Upon saving a file the formatter is called and also the updated contents of the file are visible in the "buffer" (not sure if this is the right neovim terminology for the file you actually see).
Actual behaviour
The formatter is run but the updated contents are not immediately visible in the buffer. One must either alt-tab away and back or close & reopen the file or use :e to view the updated contents.
Output of :checkhealth guard
Executable check ~
- OK forge found
Settings ~
- OK fmt_on_save: true
- OK lsp_as_default_formatter: false
- OK save_on_fmt: true
Tools registered for current buffer (bufnr 1) ~
- OK Current buffer has filetype solidity:
- 1 formatter autocmds attached
- 0 linter autocmds attached
- formatters:
- {
args = { "fmt" },
cmd = "forge",
stdin = false
}
How to reproduce the issue
Setup Minimal Neovim & Install Formatter
mkdir /tmp/guard-repro
cd /tmp/guard-repro
git clone https://github.com/nvimdev/guard.nvim
git clone https://github.com/nvimdev/guard-collection
# Installs `forge`
curl -L https://foundry.paradigm.xyz | bash
foundryup
Create Minimal Neovim Config
vim.opt.rtp:append('/tmp/guard-repro/guard.nvim')
vim.opt.rtp:append('/tmp/guard-repro/guard-collection')
local ft = require('guard.filetype')
ft("solidity"):fmt({
cmd = "forge",
args = { "fmt" },
stdin = false,
})
Setup Minimal Foundry Project
mkdir src
echo "contract A {}" > src/mini.sol
touch foundry.toml
Open neovim
nvim --clean -u repro.lua src/mini.sol
Test Behavior
- Insert spaces between curly braces
- Trigger formatting with
:w
- Observe no changes
- "refresh" file via
:e or alt-tabbing => file updated
Are you sure this is a min repro?
Neovim version (nvim -v)
NVIM v0.11.0 Build type: Release LuaJIT 2.1.1744318430
Operating system/version
MacOS Sonoma 14.5
Expected behaviour
Upon saving a file the formatter is called and also the updated contents of the file are visible in the "buffer" (not sure if this is the right neovim terminology for the file you actually see).
Actual behaviour
The formatter is run but the updated contents are not immediately visible in the buffer. One must either alt-tab away and back or close & reopen the file or use
:eto view the updated contents.Output of :checkhealth guard
How to reproduce the issue
Setup Minimal Neovim & Install Formatter
Create Minimal Neovim Config
Setup Minimal Foundry Project
Open neovim
Test Behavior
:w:eor alt-tabbing => file updatedAre you sure this is a min repro?
vim.opt.rtpand configuration themselves