iamcco / coc-flutter

flutter support for (Neo)vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resumeNotification not called within same tick: Error

gronka opened this issue · comments

When I launch vim on a dart file that imports flutter/material, I get the message "Starting device daemon...". Then, the coc errors in my code load. Finally, I get this error message on the bottom of my screen:
[lsc:Error] Error from message handler: 'Vim(call):E117: Unknown function: win_execute'

After I save, all error highlights in code disappear. I assume lsc has crashed and it's cache is wiped at this point.

To Reproduce
call vim *.dart
This is occurring on all of my dart files that import flutter/material

Expected behavior
I expect no error message.
I expect errors to refresh on file save instead of disappearing.

Desktop (please complete the following information):
Linux pop-os 5.8.0-7642-generic #47161400714920.04~82fb226-Ubuntu SMP Tue Feb 23 02:56:27 UTC x86_64 x86_64 x86_64 GNU/Linux

NVIM v0.4.4
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-aKIhK1/neovim-0.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-aKIhK1/neovim-0.4.4/build/config -I/build/neovim-aKIhK1/neovim-0.4.4/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-aKIhK1/neovim-0.4.4/build/src/nvim/auto -I/build/neovim-aKIhK1/neovim-0.4.4/build/include
Compiled by team+vim@tracker.debian.org

The same error seems to occur with VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31), but there is no error message. On vim when I call :CocCommand workspace.showOutput nothing happens

Output channel:

[dev-command]: register dev command
[sdk]: No local fvm sdk
[sdk]: which flutter command => /home/supper/apps/flutter/bin/flutter
[fs]: executing command cat /home/supper/apps/flutter/version
[sdk]: searchPaths: ~/snap/flutter/common/flutter
[sdk]: flutter command path => /home/supper/apps/flutter/bin/flutter
[sdk]: dart sdk home => /home/supper/apps/flutter/bin/cache/dart-sdk
[sdk]: analyzer path => /home/supper/apps/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot
[sdk]: dart command path => /home/supper/apps/flutter/bin/cache/dart-sdk/bin/dart
[fs]: executing command /home/supper/apps/flutter/bin/cache/dart-sdk/bin/dart --version
[sdk]: dart version: v2.13.0
[lsp-server]: rightVersion true
[lsp-server]: analysis server ready!
[lsp-closing-labels]: register closing labels
[daemon]: got message: {
  "event": "daemon.connected",
  "params": {
    "version": "0.6.0",
    "pid": 51232
  }
}
[daemon]: got message: {
  "event": "daemon.logMessage",
  "params": {
    "level": "status",
    "message": "Starting device daemon..."
  }
}
[daemon]: got message: {
  "id": 1
}
[daemon]: Message without event
[daemon]: got message: {
  "event": "device.added",
  "params": {
    "id": "linux",
    "name": "Linux",
    "platform": "linux-x64",
    "emulator": false,
    "category": "desktop",
    "platformType": "linux",
    "ephemeral": false,
    "emulatorId": null
  }
}
[daemon]: New device: Linux
[daemon]: got message: {
  "event": "device.added",
  "params": {
    "id": "chrome",
    "name": "Chrome",
    "platform": "web-javascript",
    "emulator": false,
    "category": "web",
    "platformType": "web",
    "ephemeral": false,
    "emulatorId": null
  }
}
[daemon]: New device: Chrome
[daemon]: got message: {
  "event": "device.added",
  "params": {
    "id": "emulator-5554",
    "name": "sdk gphone x86 arm",
    "platform": "android-x86",
    "emulator": true,
    "category": "mobile",
    "platformType": "android",
    "ephemeral": true,
    "emulatorId": "Pixel_3a_API_30_x86"
  }
}
[daemon]: New device: sdk gphone x86 arm

Config
This error occurs when my config is blank. But I also tried it with these settings:

{                                                                               
    "coc.preferences.formatOnSaveFiletypes": [                                  
        //"dart",                                                                   
    ],                                                                          
    "flutter.provider.hot-reload": false,                                       
    "flutter.trace.server": "verbose",                                          
}                                                                                           

Interesting, this only happens if the file import flutter material?

Could you also share the output of coc itself

This error does not occur when I am not running my android emulator.

This error does not occur when I am not running my android emulator

That’s weird

I restarted my avd Pixel emulator (I had tried this before) and now the plugin seems entirely different.

I'm not even sure what to say. 10 minutes ago there was not much code-highlighting - errors were underlined. Now the errors are highlighted bold red (which looks much nicer lol). Maybe some part of the avd pipeline was caching something?

I'm not sure if it's related, but now I have to save a file twice sometimes for error messages to appear - but the highlight seems to still show. At the moment, I can't recreate my issue. Maybe my issue is already solved?

How do I capture coc's output?

I'm not even sure what to say. 10 minutes ago there was not much code-highlighting - errors were underlined. Now the errors are highlighted bold red (which looks much nicer lol). Maybe some part of the avd pipeline was caching something?

The bold red is the default coc uses indeed

I'm not sure if it's related, but now I have to save a file twice sometimes for error messages to appear - but the highlight seems to still show. At the moment, I can't recreate my issue. Maybe my issue is already solved?

You have to save the file before it shows you the diagnostics? That doesn't sound correct.

This sounds like you have some kind of configuration issue.
Which version are you using of coc?

How do I capture coc's output?

Use :CocOpenLog

Do you also have another lsp client installed?

I found the exact error you posted for vim-lsc

You have to save the file before it shows you the diagnostics? That doesn't sound correct.

Diagnostics load when the file opens. Sometimes after saving (10% of the time?) diagnostics are hidden. But the bold red remains and is visual queue enough to save again. It's not ideal, but it doesn't really bother me

Which version are you using of coc?

I'm not sure if there's a command for this, but if I cat ~/.vim/bundle/coc.vim/package.json it says coc.nvim version 0.0.80

This sounds like you have some kind of configuration issue.

It's likely

Do you also have another lsp client installed?

Yes. It is common to use both coc and lcs, correct?

.vimrc snippet

" Flutter
Plugin 'thosakwe/vim-flutter'
Plugin 'dart-lang/dart-vim-plugin'
Plugin 'natebosch/vim-lsc'
Plugin 'natebosch/vim-lsc-dart'
Plugin 'neoclide/coc.nvim', {'branch': 'release'}

let g:lsc_auto_map = v:true

When I remove vim-lsc and vim-lsc-dart with :PluginClean, the interface of this plugin seems to go back to what I originally described. That is, all diagnostics are usually lost after saving (maybe 70% of the time), and errors are underlined instead of being highlighted in bold red font. (Both with emulator not restarted and with emulator closed.)

This is interesting, but for me things are working well enough and I'm happy. Let me know if you want me to test something.

Thanks for finding the cross-reference

Yes. It is common to use both coc and lcs, correct?

Not sure but it sounds like it is at least overkill haha.

This is interesting, but for me things are working well enough and I'm happy. Let me know if you want me to test something.

Alright feel free to open a new issue if there is something that needs improving :)

So, after toying with lsc the error is happening consistently, as originally described (all coc diagnostics disappear after saving most of the time).

I removed vim-lsc, vim-lsc-dart, and thosakwe/vim-flutter and I deleted the folder ~/.config/coc, then reinstalled coc:

Plugin 'dart-lang/dart-vim-plugin'
Plugin 'neoclide/coc.nvim', {'branch': 'release'}

:CocOpenLog after adding a new line to a file and saving a few times:

2021-03-28T17:18:38.833 INFO (pid:11646) [plugin] - coc.nvim 0.0.80-d129f0f97e initialized with node: v10.19.0 after 178ms
2021-03-28T17:18:38.857 INFO (pid:11646) [services] - registered service "flutter"
2021-03-28T17:18:38.858 INFO (pid:11646) [services] - flutter analysis server state change: stopped => starting
2021-03-28T17:18:38.862 INFO (pid:11646) [language-client-index] - Language server "flutter" started with 11666
2021-03-28T17:18:39.179 INFO (pid:11646) [services] - flutter analysis server state change: starting => running
2021-03-28T17:18:39.182 INFO (pid:11646) [services] - service flutter started
2021-03-28T17:18:39.404 ERROR (pid:11646) [node-client] - resumeNotification not called within same tick: Error
    at tM.pauseNotification (/home/supper/.vim/bundle/coc.nvim/build/index.js:23:4591)
    at Li.show (/home/supper/.config/coc/extensions/node_modules/coc-flutter/out/index.js:35:2864)
    at process._tickCallback (internal/process/next_tick.js:68:7)
2021-03-28T17:18:39.438 ERROR (pid:11646) [node-client] - resumeNotification not called within same tick: Error
    at tM.pauseNotification (/home/supper/.vim/bundle/coc.nvim/build/index.js:23:4591)
    at kD.setStatusText (/home/supper/.vim/bundle/coc.nvim/build/index.js:159:3338)
    at Timeout.interval.setInterval [as _onTimeout] (/home/supper/.vim/bundle/coc.nvim/build/index.js:159:2660)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
2021-03-28T17:18:42.891 INFO (pid:11646) [attach] - receive notification: doAutocmd [ 2 ]
2021-03-28T17:18:43.619 INFO (pid:11646) [attach] - receive request: CocAutocmd [ 'BufWritePre', 1 ]
2021-03-28T17:18:54.481 INFO (pid:11646) [attach] - receive notification: doAutocmd [ 2 ]
2021-03-28T17:18:55.181 INFO (pid:11646) [attach] - receive request: CocAutocmd [ 'BufWritePre', 1 ]
2021-03-28T17:20:14.772 INFO (pid:11646) [attach] - receive notification: openLog []

If I open :CocDiagnostics all output disappears when all the text-decorations disappear.

Just for the record, you're no longer seeing [lsc:Error] Error from message handler: 'Vim(call):E117: Unknown function: win_execute' right?

Just for the record, you're no longer seeing [lsc:Error] Error from message handler: 'Vim(call):E117: Unknown function: win_execute' right?

Correct. The lsc folders are gone from my .vim/bundle folder.

I'm not sure why coc was working fine, nor why reinstalling lsc broke it again. For now I'm trying to do a clean install with only coc

I'm not sure why coc was working fine, nor why reinstalling lsc broke it again. For now I'm trying to do a clean install with only coc

Ow you reinstalled lsc and that's when it broke again 🙈

Then I'm gonna close this again, I don't think it's normal to run both at the same time and can definitely imagine that that would give problems.

Still strange though that it sorta breaks but still works half of the time.

Ow you reinstalled lsc and that's when it broke again

No, lsc is gone. I should actually say that coc broke after I uninstalled lsc, lol

Then I reinstalled lsc and it was still broken. So now I've removed everything. All I have in my vimrc for dart is:

Plugin 'dart-lang/dart-vim-plugin'
Plugin 'neoclide/coc.nvim', {'branch': 'release'}

This looks like an issue with coc.nvim's use of resumeNotification (which seems to come from nvim), so I might open an issue there. It could also be an issue with how coc-flutter is implementing coc.

This looks like an issue with coc.nvim's use of resumeNotification (which seems to come from nvim), so I might open an issue there. It could also be an issue with how coc-flutter is implementing coc.

Why do you think it has something to do with that?

Why do you think it has something to do with that?

I assumed resumeNotification was a low level call to vim/nvim. But, it doesn't show up in the nvim repo nor the coc.nvim repo, so I guess I'm wrong. I don't know where to look next.

I installed coc-flutter on my Void linux machine, and it works well. It is using underlines instead of bold red font (config?), but I don't see any issues otherwise.

The resume notification error is unrelated and you can ignore it (we are looking into it still but other then showing the error it doesnt cause any issues)

Good to hear you got it working.
You can indeed configure how the errors look just make sure to set them loading your colorscheme (in case it overwrites them).

I personally use the following:

highlight CocErrorHighlight guibg=#660000 guifg=None gui=italic
highlight CocWarningHighlight guibg=#666600 guifg=#ffa600 gui=bold,underline
2021-03-28T17:18:38.833 INFO (pid:11646) [plugin] - coc.nvim 0.0.80-d129f0f97e initialized with node: v10.19.0 after 178ms
2021-03-28T17:18:38.857 INFO (pid:11646) [services] - registered service "flutter"
2021-03-28T17:18:38.858 INFO (pid:11646) [services] - flutter analysis server state change: stopped => starting
2021-03-28T17:18:38.862 INFO (pid:11646) [language-client-index] - Language server "flutter" started with 11666
2021-03-28T17:18:39.179 INFO (pid:11646) [services] - flutter analysis server state change: starting => running
2021-03-28T17:18:39.182 INFO (pid:11646) [services] - service flutter started
2021-03-28T17:18:39.404 ERROR (pid:11646) [node-client] - resumeNotification not called within same tick: Error
    at tM.pauseNotification (/home/supper/.vim/bundle/coc.nvim/build/index.js:23:4591)
    at Li.show (/home/supper/.config/coc/extensions/node_modules/coc-flutter/out/index.js:35:2864)
    at process._tickCallback (internal/process/next_tick.js:68:7)
2021-03-28T17:18:39.438 ERROR (pid:11646) [node-client] - resumeNotification not called within same tick: Error
    at tM.pauseNotification (/home/supper/.vim/bundle/coc.nvim/build/index.js:23:4591)
    at kD.setStatusText (/home/supper/.vim/bundle/coc.nvim/build/index.js:159:3338)
    at Timeout.interval.setInterval [as _onTimeout] (/home/supper/.vim/bundle/coc.nvim/build/index.js:159:2660)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
2021-03-28T17:18:42.891 INFO (pid:11646) [attach] - receive notification: doAutocmd [ 2 ]
2021-03-28T17:18:43.619 INFO (pid:11646) [attach] - receive request: CocAutocmd [ 'BufWritePre', 1 ]
2021-03-28T17:18:54.481 INFO (pid:11646) [attach] - receive notification: doAutocmd [ 2 ]
2021-03-28T17:18:55.181 INFO (pid:11646) [attach] - receive request: CocAutocmd [ 'BufWritePre', 1 ]
2021-03-28T17:20:14.772 INFO (pid:11646) [attach] - receive notification: openLog []

@gronka Seems like bug fo coc-flutter, please test with #117

Let's reopen to make track easier

@gronka Seems like bug fo coc-flutter, please test with #117

Thanks! The resumeNotification error is gone, but the main issue persists (coc diagnostics disappear after 70% of saves). With flutter.trace.server set to verbose, the log doesn't show much. This log looks the same on both my popos and void laptops:

2021-03-30T12:29:53.697 INFO (pid:16125) [plugin] - coc.nvim 0.0.80-d129f0f97e initialized with node: v10.19.0 after 184ms       
2021-03-30T12:29:53.722 INFO (pid:16125) [services] - registered service "flutter"                                               
2021-03-30T12:29:53.723 INFO (pid:16125) [services] - flutter analysis server state change: stopped => starting
2021-03-30T12:29:53.728 INFO (pid:16125) [language-client-index] - Language server "flutter" started with 16144
2021-03-30T12:29:54.061 INFO (pid:16125) [services] - flutter analysis server state change: starting => running
2021-03-30T12:29:54.064 INFO (pid:16125) [services] - service flutter started     
2021-03-30T12:29:59.537 INFO (pid:16125) [attach] - receive notification: doAutocmd [ 2 ]
2021-03-30T12:30:00.358 INFO (pid:16125) [attach] - receive request: CocAutocmd [ 'BufWritePre', 1 ]
2021-03-30T12:30:03.943 INFO (pid:16125) [attach] - receive notification: openLog []

@iamcco fyi, the diagnostics always load on file open. So, I can still use coc-flutter even though it's janky. I can make keybinds for coc#refresh() and :CocRestart which can get me through for now.

What I'm saying is it would be nice if this worked, but it's not a major issue for me so you can leave this as low priority.

Good to hear you got it working.

It works on my Void laptop. It's still broken on my Popos laptop. I use a github repo to sync my dotfiles, so vimrc and such are exactly the same. So, maybe it's a Pop os issue

Popos (based on ubuntu) will be releasing their next version in a month (alongside the ubuntu update) - maybe that will fix it. There is a high chance I will install void since I have fewer issues on void. I tried updating from node v10.something to v15.12.0, which didn't help.

@iamcco fyi, the diagnostics always load on file open. So, I can still use coc-flutter even though it's janky. I can make keybinds for coc#refresh and :CocRestart which can get me through for now.

coc#refresh fixes it?

coc#refresh fixes it?

It doesn't fix it. It updates the diagnostics each time I run it. Oh lol I just read that coc#refresh is for updating completion. I assumed it refreshed everything. Well, that's a bit odd. It refreshes my errors as well.

What happens if the diagnostics are missing and you do :e to reload the file?

What happens if the diagnostics are missing and you do :e to reload the file?

This also refreshes the diagnostics.

Setting "diagnostic.refreshOnInsertMode": true, in :CocConfig is the workaround I'll go with for now.

Maybe tomorrow I'll try another coc plugin, which should determine if this is an issue with coc or coc-flutter

when flutter.trace.server set to verbos you should checkout by :CocCommand workspace.showOutput then select flutter-lsp to see if the server return diagnostics.

coc-flutter does not handle diagnostics display of hide. It's control by coc.nvim.

All this definitely sounds like it’s going wrong at coc’s end.

I also noticed you’re running quite an old version of node, is the other machine where it works correctly using a newer version perhaps?