Closed ianchanning closed 3 years ago
Happens on unsaved buffer, but not exists file.
I'm getting these crashes more an more. It happens every couple of hours. I'll try and recreate a minimal version
I'm getting the same issue. I can fix the issue but coc still reports the issue (eslint in my case). I can re-read the file :e
and it will update the eslint issues.
I'm also getting the same issue. The error indication persists after the fix. Mostly happens when working with React files. The "workspace.showOutput" is clean with no errors.
Happens on unsaved buffer, but not exists file.
So this is not exactly what I see - but I think it's something close.
I believe the problems with Coc started after I turned on the eslint 'fix on save' option:
"eslint.autoFixOnSave": true,
So in my case the file definitely exists, it's a relatively long (almost always 200+ lines) React JSX file. But I see that sometimes the fix on save doesn't properly work. After I save the file eslint will modify the file and I will need to save it again.
For the moment I have turned this off and I will see if I experience any more problems. If I don't have any more problems for a while, then I'll try turning the fix on save back on with a minimal config.
Even with autoFixOnSave turned off it still crashes:
I can't reproduced this with latest coc.nvim and eslint, please upload verbose output of eslint https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
So I'm now seeing this bug:
It got "stuck" after this error:
[eslint no-undef] [E] 'c' is not defined. (no-undef)
for when I started typing const
and then even though I've typed the rest of the line const checked = value === null ? false : checked;
it stays with the error.
This is the output I get from :CocCommand workspace.showOutput
, I've created a gist because it's too big to paste: https://gist.github.com/ianchanning/134988a5d3aed9f87a3dfb464682d51b
The content of document is wrong, maybe you're using old coc.nvim
CocInfo
:
## versions
vim version: NVIM v0.4.4
node version: v12.18.4
coc.nvim version: 0.0.79-b71489207a
coc.nvim directory: /home/channi16/.vim/bundle/coc.nvim
term: xterm-256color
platform: linux
Indeed - I'm on 0.0.79 vs the 1.31 that is here. But as far as I know I'm just using Plug to pull in the latest version...
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Oh - no, I'm mixing up the coc-eslint version and coc version. It does look like my coc version is the latest.
I'll add my data as well. Still run into the issue. It also happens when I do a /
search. The thing I'm searching will throw errors.
## versions
vim version: NVIM v0.4.4
node version: v12.18.4
coc.nvim version: 0.0.79-b71489207a
coc.nvim directory: /home/berkeleytrue/.config/nvim/plugged/coc.nvim
term: screen-256color
platform: linux
+ coc-eslint 1.2.7 ~/.config/coc/extensions/node_modules/coc-eslint
I'm getting these errors so often now that I've switched to using the minimal vim mini.vim
that you suggest when creating a new bug in for coc.nvim.
Here's my ~/.mini.vim
:
set nocompatible
set runtimepath^=/home/channi16/.vim/bundle/coc.nvim
filetype plugin indent on
syntax on
set hidden
I start nvim using a Session that was created by Tim Pope's vim-obsession plugin:
cd ~/my-projects-root
vim -S Session.vim -u ~/mini.vim
After about an hour of using nvim I get the following error:
✖ const projectMemberIds = projectMembers.map((m) => m.Contact__c);
[eslint no-undef] [E] 'c' is not defined. (no-undef)
——————————————————————————————————————————————————————————————————————————————
[eslint no-unused-expressions] [E] Expected an assignment or function call and
instead saw an expression. (no-unused-expressions)
It generated the error, which I then fixed, but the eslint error remains.
I have a fairly complex setup of projects, they mostly look similar to this project, but all under the one my-projects-root
:
~/my-projects-root
└── my-project-1
└── images
│ front
│ ├── node_modules
│ ├── .eslintrc
│ └── package.json
└── api
├── node_modules
├── .eslintrc.json
└── package.json
So I have lots of different directories with separate .eslintrc
files.
However I haven't had a problem with linting for years, it has only started happening within the last few months.
I've been having similar problems for a long time, but it's been getting increasingly common recently from what I can tell. I have autoformatting with coc-eslint and coc-prettier turned on, but another reports that disabling it doesn't fix the issue so it might be related to something else.
I have currently given up with coc, it's a shame but there's nothing that I can see that is the problem. Perhaps it's something to do with my eslint setup, but I don't think so - I got tsserver errors. Anyway I'm going to switch back to trying with ALE and maybe some other linting plugins to see if they have similar issues.
coc is still the best LSP plugin I used if it works, so I'm hoping there is a fix for this somewhere.
Could be problem with neovim's buffer lines change event, I can't experience it, try :e!
to reload the buffer.
Ok, I'll give that a try, I just did :CocRestart
each time.
I could also try with Vim instead of Neovim to see if that has the same problems
I have now hit the same issue almost immediately when running this in Vim 8, so it's not a Neovim problem:
## versions
vim version: VIM - Vi IMproved 8.2 8021767
node version: v12.19.0
coc.nvim version: 0.0.79-d4d93dc25f
coc.nvim directory: /home/channi16/.vim/bundle/coc.nvim
term: dumb
platform: linux
## Output channel: eslint
[Info - 14:24:01] ESLint server running in node v12.19.0
[Info - 14:24:02] ESLint library loaded from: /home/channi16/imec/innovatrix/images/api/node_modules/eslint/lib/api.js
I can now get this to break every time.
I start a new line, type const the
go onto the next line and then hit Esc
to go back to normal mode.
It then generates errors for the first character I have typed but doesn't clear them.
It's as if it thinks all I have typed is c
, on the second character of the line it has 'missing semi-colon'.
:e!
does indeed remove the errors similar to :CocRestart
, but obviously that is not a solution.
Can't reproduce, need connection log of coc.nvim to address this issue, please follow these steps:
let g:node_client_debug = 1
to your vimrc, save your vimrc and exit vim.Thanks for your replies. I did this with Vim8 as I can reproduce the error every time now. Output log file: https://gist.github.com/ianchanning/201cb323e9ae90aec06c37b719f2dac1
Also I don't know how relevant this is, but normally from what I remember the errors get put into the location list, but here, although I've got 3 errors (the E:3
in the tagline) there's nothing in the location list
Auto change location list was removed, use :CocDiagnistic command to open location list with diagnostics
Can you try adding "diagnostic.refreshOnInsertMode": true
to your CocConfig and see if that fixes it?
Admittedly, the issue doesn't happen a ton to me, so I'm not sure if it is still occurring, but since adding this I haven't had any stale diagnostics.
EDIT: Seems like it's happened at least once now, but maybe it's reducing frequency?
@johnpyp No sadly that doesn't help.
However I have made some progress. If I type really slowly whilst in insert mode and wait for the errors to correct themselves as I am typing before returning to normal mode then it works correctly.
It's only if I type something very fast in insert mode and then quickly switch back to normal mode that it gets stuck with the error messages.
I have reproduced the problem with big file, looks like eslint server ignores new text documents when it's too busy.
@chemzqm fwiw I am having this issue on a file with only 32 loc; however, it is in a large project
Hey @chemzqm is there any progress on this? Its a huge detractor for the user experience of coc.nvim
which would otherwise make vim every bit as good as VsCode
I'm using iamcco/coc-diagnostic: diagnostic-languageserver extension for coc.nvim for eslint until coc-eslint
improves on this:
coc-settings.json:
{
"diagnostic.refreshOnInsertMode": true,
"diagnostic.messageDelay": 500,
"diagnostic.refreshAfterSave": false,
"diagnostic-languageserver.filetypes": {
"javascript": "eslint"
},
"diagnostic-languageserver.linters": {
"eslint": {
"command": "./node_modules/.bin/eslint",
"rootPatterns": [".git", "package.json"],
"debounce": 100,
"args": ["--stdin", "--stdin-filename", "%filepath", "--format", "json"],
"sourceName": "eslint",
"parseJson": {
"errorsRoot": "[0].messages",
"line": "line",
"column": "column",
"endLine": "endLine",
"endColumn": "endColumn",
"message": "${message} [${ruleId}]",
"security": "severity"
},
"securities": {
"2": "error",
"1": "warning"
}
}
}
}
@davidsierradz Thanks! I'll definitely give that a go. Hope it works!
Will try to fix after coc.nvim 0.0.80 released.
@chemzqm do you have any ideas about the cause? I would be willing to help if you were able to narrow down the problem.
I saw in https://github.com/neoclide/coc.nvim/issues/2662 that it could be an issue with the fastDiff dependency. I pulled this repo down locally and replaced fastDiff and getChange
with a native implementation using the n-api. It greatly reduces the execution time of getChange, but coc-eslint
remains really sluggish overall. Do you think it's an issue with eslint in general?
Could be issue with willSaveUntil, only one language server should be allowed for changes .
Try coc-eslint 1.4.0, if you still have this issue, open new issue with output of eslint.
Thank you this is great. I haven't tested it yet but I've done the upgrade. This wasn't obvious to me how to do this. If anyone else is wondering:
:PlugUpdate
fixed that. coc-eslint
either re-run :CocInstall coc-eslint
or :CocUpdate
will update the coc plugin.From what I can tell this is working. It gets into the same state with incorrect errors but they now get cleaned up after a short while.
Yeah, same here. It appears to be working for me!
Result from CocInfo
Describe the bug
The bug is hard to reproduce because it is only temporary. But it happens multiple times per day.
It happens with both coc-eslint and coc-tsserver so I don't believe that it is an issue with those individually.
What happens is that I get a linting error message that shows a warning.
I then fix that error but the warning does not go away.
So I am left with a warning that I can't clear. I can run
:CocRestart
to clear the warning, but it seems like this is a bug.Reproduce the bug
I can't reproduce this directly - it only happens on occasion about twice per day.
I have removed the coc-tsserver plugin to make sure it is nothing to do with coc-tsserver and coc-eslint conflicting.
Screenshots (optional)
You can see here that the eslint warning is pointing to line 661 where the variable used to be - but I have since move the variable a few lines up and fixed the warning.