The problem is LSP.
Using :LspRestart
works like a charm in my case.
Can try to setup auto :LspRestart
on file save.
Add this to your init.lua or init.vim:
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.py",
callback = function()
vim.cmd("LspRestart")
end,
})
Or edit your lspconfig
pyright settings:
require'lspconfig'.pyright.setup{
settings = {
python = {
analysis = {
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "workspace",
},
},
},
}
According to ChatGPT:
Inotify vs. FSEvents (Linux vs. macOS)