Open christianhturner opened 2 months ago
Can confirm this bug. Encountered it in a large TypeScript/React Problem and only had the issue in .tsx
files. Normal .ts
files don't appear to cause this error.
Hm... It seems the snippet is broken. It is truncated?
Note: https://github.com/hrsh7th/nvim-cmp/commit/b356f2c80cb6c5bae2a65d7f9c82dd5c3fdd6038
I think it truncate.
Hm... It seems the snippet is broken. It is truncated?
Note: b356f2c
I think it truncate.
So this is the last commit that is working for me, apologies if I wasn't clear regarding that in the original post, a very truncated version of my actual config (I ommited the commit in the top level minimal config, since it works when I specify this commit:
"hrsh7th/nvim-cmp",
commit = "b356f2c",
dependencies = {
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
.
.
.
This is the commit that seems to have broke the plugin for me: b7b2c12
Looking at this commit it appears that utils/snippet.lua
is a brand new implementation and file. That is where I'm getting the error as well, specifically at Line 409.
Can confirm this bug. Encountered it in a large TypeScript/React Problem and only had the issue in
.tsx
files. Normal.ts
files don't appear to cause this error.
I have the same problem also in normal .ts files
So this is the last commit that is working for me, apologies if I wasn't clear regarding that in the original post, a very truncated version of my actual config (I ommited the commit in the top level minimal config, since it works when I specify this commit:
commit = "b356f2c",
Can confirm this commit is working, thanks for bisecting!
I tried last commit, but this issue isn't solved, last working is b356f2c
After doing some more investigating on this issue, I found a resolution for my project. At this point I'm not sure if it's nvim-cmp issue or an issue with the LSP itself. I'm working on a project where I'm building a plugin for an electron application. In order to get completion I have a folder called external where I'm creating soft links to the project code that is exporting the global variables. Whenever I remove that folder from my project, I can use the most up to date nvim-cmp. I also noted that the reliability (even when using the older version of nvim-cmp) are more reliable and faster when I remove this directory. I"m not sure if this is a size issue, since others mentioned this issu when working on large projects.
I don't want to close the issue unless it can't be resolved and it has something to do with our projects, I don't think this is likely since it did previously work. Seems like there may need to be some sort of exception that the new implementation is able to handle that it currently isn't. I'd be more than happy to gather more information if that would be helpful, but I'm not entirely sure where I should start. I'll leave this open for now, as the maintainer can always close it.
Not sure if anyone else has gathered any more information since their original issues.
I've run into similar issue in a project using Svelte.
While trying to type in insert mode on the *.svelte
fules, I get a spam of the following error:
Error executing vim.schedule lua callback: ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:409: snippet parsing failed.
stack traceback:
[C]: in function 'error'
...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:409: in function 'parse'
...xeho91/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:130: in function 'callback'
.../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_word'
...xeho91/.local/share/nvim/lazy/nvim-cmp/lua/cmp/entry.lua:81: in function 'callback'
.../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_offset'
...eho91/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:353: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
It might be related to this issue: https://github.com/hrsh7th/nvim-cmp/issues/1858
I pinned nvim-cmp
version to commit: https://github.com/hrsh7th/nvim-cmp/commit/b356f2c80cb6c5bae2a65d7f9c82dd5c3fdd6038
Source: https://github.com/hrsh7th/nvim-cmp/issues/1858#issuecomment-2014660238
To anyone using LazyVim, there's the quick snippet that may help you continue to work:
return {
{
-- https://github.com/hrsh7th/nvim-cmp
"hrsh7th/nvim-cmp",
commit = "b356f2c",
pin = true,
},
}
To anyone using LazyVim, there's the quick snippet that may help you continue to work:
return { { -- https://github.com/hrsh7th/nvim-cmp "hrsh7th/nvim-cmp", commit = "b356f2c", pin = true, }, }
Since I'm using LazyVim distro, if I write a simple lua file in my plugins directory does it overwrite all nvim-cmp configuration or does it simply update it?
Tried what @xeho91 said, yet LazyVim is updating to the latests version all the time... Can't find what's wrong in the config 🤔
To anyone using LazyVim, there's the quick snippet that may help you continue to work:
return { { -- https://github.com/hrsh7th/nvim-cmp "hrsh7th/nvim-cmp", commit = "b356f2c", pin = true, }, }
Since I'm using LazyVim distro, if I write a simple lua file in my plugins directory does it overwrite all nvim-cmp configuration or does it simply update it?
I can't give an honest answer, because I don't override the default config for nvim-cmp
set by LazyVim.
Tried what @xeho91 said, yet LazyVim is updating to the latests version all the time... Can't find what's wrong in the config 🤔
Don't mind me, made it work finally.
@mikededo How exactly did you make it work? I'm having the same issue and have tried pretty much everything.
@Lompad I was having the same issue, and reinstalling everything with the pinned commit version config from the get go solved it for me.
My uneducated guess is that lazy-lock or something on the shared folder were conflicting with the pin commit and preventing it from taking effect.
Same for me. After pinning nvim-cmp to that specific commit as described above, I removed nvim-cmp via the Lazy menu (leader L) and from there I removed the nvim-cmp package (go to the nvim-cmp line and hit 'x'). After that close and re-open nvim and the error is gone.
Thanks for the workaround guys. Now let's hope the real solution will come soon.
I think this has been fixed with one of the latest commits. Just removed the pin to the suggested commit and I did not get this error in the places where I got them last time
So it should be closed?
I don't think so , error is still present on latest cmp
sadly
FAQ
Announcement
Minimal reproducible full config
Description
I'm receiving the following parsing error: Error 08:05:18 notify.error ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/snippet.lua:411: snippet parsing failed. I've identified that the issue began after the last known working commit for me, "b356f2c". Starting at this commit I begin receiving the error being documented. I went into the code base of nvim-cmp, and printed the input being parsed, and while erroring the input is always
$a
, followed by the parsing error.I set debugging within the code base to true, and was able to catch this additional logging on the issue:
This issue is not happening in every project, or even every project with this LSP. I'm having issues with a javascript project. More context in the section below related to context.
Steps to reproduce
If you wish to see the issue within the project that it's occurring within you can feel free to clone the repo I'm working within with:
or
This assumes you are within a project that could cause this issue, more context below if you want to attempt to create a troublesome project.
InsertEnter
and begin typing.c
; error notification, presso
; error notification, pressn
; error notification, presss
; error notification, presst
error notification, pressspace
; error notification. It will stop once you complete the symbol name and append it with aspace
. You can even back space back into the symbol and completion will begin working. You can type a variable name, followed by=
, but after this you'll begin receiving completion errors again.Expected behavior
When typing you should receive completion context without receiving parsing errors.
Actual behavior
When typing through the project, about 80% of time I'm receiving parsing errors when completion is attempting to occur. I'm not receiving any errors from the LSP. Given this project is the only project I'm having issues with, I thought that maybe there was any issue with the LSP and the data being received by the LSP. It's possible that nvim-cmp can't handle the input being received from the LSP, but what's being output by the LSP in itself doesn't appear to be problematic and most likely it should be something that nvim-cmp should be able to handle.
Additionally, this issue does not occur with commit b356f2c, or any before this commit. I found a commit further back to see if the issue occurred then (a commit from December I believe), and it did not. I then tried every commit from December to present until i encounter the first commit where the problem resumed.
Additional context
I provided the codebase where I'm experiencing this issue, but I'll provide context to the project in the event that someone wishes to try and create a project that the issue occurs within. When using the most current version of nvim-cmp I typically do not have issues with javascript, typescript, or golang. This particular project I admit is more bespoke and is an edge case. It's a module for a tabletop roleplaying platform and I'm using a library for it which allows svelte to transpile to work within the system. It's a javascript project. Here are a few things that I'm doing that I'm not doing in projects that don't have this issues.
external/
found in the project root which link to the application source code to provide type completion and context to global variables within the application.external/
My suspicion is that JSDOC or typescript typing inside of javascript project might be causing the issue. I've tried suppressing the JSDOC (removing them; and the issue resumes) not sure if there is caching or anything like that though.