Comments (13)
Here's the scenario that I guess you were running into.
- In insert mode, do some edits that update the syntax tree.
- Leave insert mode with ctrl-c.
- Make edits in normal mode that update the syntax tree. This happens to be the change made by code_action.
- Enter insert mode, and leave insert mode with ESC, without making changes.
- nil error
I have fixed this and explained why this happens in neovim/neovim#29581
from lazyvim.
@tomtomjhj of course dafuq was I thinking XD
from lazyvim.
Looks like a Neovim bug
from lazyvim.
the error message says that the error happened when processing bufwritepre, which means that nvim was saving the file and trigger auto formating (which isnt included in your repro steps). were you actually saving the file when this happened? can you reproduce this by doing some edits in insert mode and concurrently trigger auto formatting without leaving insert mode?
also, do you use ctrl-c to exit insert mode?
from lazyvim.
yes I do use mostly ctrl-c instead of esc as much as possible. Do you think it can affect this?
This happens randomly. For example this happens when I try to exit fzf-lua window when I am checking for lsp references and kill it with ctrl-c. But I noticed it mostly happens with list of new references that I haven't visited yet.
Or this happens when I try to complete the auto imports from normal mode with tsserver or typescript-tools add imports functionality with lsp code actions. And again happens with new imports mostly.
@tomtomjhj can you tell me how to trigger autoformatting without leaving insert mode?
from lazyvim.
yes I do use mostly ctrl-c instead of esc as much as possible. Do you think it can affect this?
yes this seems to be the root cause. leaving insert mode eith ctrl-c doesn't trigger insertleave autocmd, and this confuses treesitter fold stuff. i missed this point when i made changes to it.
the fix is simple: just add a nil check. i was initially hesitant to do this because it didnt seem necessary, but it turns out it's indeed necessary. i'll make pr soon.
from lazyvim.
Can confirm this is happening in 0.11 as well. This occurs in Typescript, Lua, Java files.
Almost 70% time this occurs when I organize imports in Typescript files or use vim.lsp.buf.code_action()
to import something. And then sometimes when I use Telescope.
from lazyvim.
@s1n7ax do you use ctrl-c to exit insert mode?
from lazyvim.
this was definitely a ctrl-c issue in my case
from lazyvim.
@tomtomjhj Yes but how is that related to error occurring when vim.lsp.buf.code_action()
is used? Anyway, just added a remap for <c-c>
to <esc>
from lazyvim.
@tomtomjhj Ah. Cool. So far no errors with nmap <c-c> <esc>
.
from lazyvim.
nmap <c-c> <esc>
don't fix the issue. Hopefully PR will be merged soon
from lazyvim.
inoremap <c-c> <esc>
from lazyvim.
Related Issues (20)
- bug: settings for outline.nvim cause symbol search crash HOT 2
- bug: debugging C# with omnisharp - netcoredbg.CMD exited with code: 1
- bug: weird keymap error HOT 3
- feature: use which-keys new dynamic `desc` and `icon` for the ui toggles HOT 3
- bug: telescope require `fd` when find files HOT 1
- bug: Mason package path not found for debugpy HOT 7
- bug: "fzf project " does not set pwd to the project path, which is different with what "telescope project" do. HOT 2
- feature: correctly overriding core plugin mini.ai
- bug: rust codelens is not complete HOT 1
- bug: lsp keymaps calling functions rather than passing function HOT 1
- bug: Mason plugin doesn't install mason-registry HOT 3
- bug: Error with nvim-cmp HOT 3
- feature: allow for overriding keymaps of dial.nvim
- bug: Can't Select Items on cmp HOT 1
- bug: Ctrl-n and Ctrl-p to go through suggestions not working anymore. HOT 2
- bug: cursor abnormal HOT 2
- bug: WARNING prettier unavailable: Condition failed
- feature: Do not update plug-ins repeatedly HOT 4
- feature: Expose a function to "process" a `toggle` to the users HOT 18
- bug: yanky extra breaks `<` and `>` in neo-tree HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lazyvim.