iamcco / coc-flutter

flutter support for (Neo)vim
472 stars 38 forks source link

[coc.nvim]: Error on "jumpDefinition": definition provider not found for current buffer, your language server doesn't support it. #140

Closed dprophete closed 2 years ago

dprophete commented 2 years ago

Hi guys,

Not sure if it's related to upgrading to the latest flutter + dart, but coc-flutter now always reports: [coc.nvim]: Error on "jumpDefinition": definition provider not found for current buffer, your language server doesn't support it. when I try to jump to definition or get the references.

Note that coc itself seems to work properly (coc goto definition works with elm files for instance)

And note that the other parts of coc-flutter do work properly (I can run :CocList FlutterEmulators, etc...)

Everything worked fine until about a week ago. Again, not sure if it's a change in coc, in coc-flutter, or it's related to moving to the latest flutter. Here is the output of flutter --version:

Flutter 2.5.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4cc385b4b8 (11 days ago) • 2021-09-07 23:01:49 -0700
Engine • revision f0826da7ef
Tools • Dart 2.14.0

Here are the coc extensions I have installed (result of CocUpdate):

Update finished

- ✓ coc-css Current version 1.2.6 is up to date.
- ✓ coc-flutter Current version 1.9.5 is up to date.
- ✓ coc-highlight Current version 1.2.8 is up to date.
- ✓ coc-html Current version 1.4.1 is up to date.
- ✓ coc-json Current version 1.3.6 is up to date.
- ✓ coc-kotlin Current version 0.0.7 is up to date.
- ✓ coc-lists Current version 1.4.2 is up to date.
- ✓ coc-prettier Current version 1.1.24 is up to date.
- ✓ coc-tsserver Current version 1.8.6 is up to date.

Also, here is the output of CocList services

    languageserver.elmLS [init] elm
    highlight [init]
  * flutter [running] dart

The dart lsp server seems to be running properly:

>> ps aux| grep dart
didier           63520   0.4  1.5  8846876 505420   ??  Ss   Fri06PM  15:19.78 /Users/didier/Library/Developer/CoreSimulator/Devices/2D658C4A-81FA-405B-989B-54E15140AC09/data/Containers/Bundle/Application/4F67E123-2181-4031-85A4-E1298013F74F/Runner.app/Runner --enable-dart-profiling --enable-checked-mode --verify-entry-points --observatory-port=0
didier           61986   0.3  0.5  5433028 158180   ??  S     8:24PM   0:03.08 /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev --packages=/Users/didier/tmp/flutter/packages/flutter_tools/.packages /Users/didier/tmp/flutter/bin/cache/flutter_tools.snapshot daemon
didier           62265   0.0  0.0  4408672    804 s010  S+    8:26PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn dart
didier           61968   0.0  0.8  5664504 252604   ??  S     8:24PM   0:04.77 /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/dart /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot --lsp

I am using the latest version of coc with

Plug 'neoclide/coc.nvim', {'branch': 'release'}

Regarding vim+dart, I tried with and without vim-lsc and vim-lsc-dart. That didn't solve the problem.

Plug 'dart-lang/dart-vim-plugin'
"Plug 'natebosch/vim-lsc'
"Plug 'natebosch/vim-lsc-dart'
"let g:lsc_auto_map = v:true

I am at a loss... Because of this I had to go back to using intellij for flutter development :-<

Hope somebody can get me out of my misery here :-) Thx guys.

llucax commented 2 years ago

Hi, I'm having a similar issue. I've been away from Flutter for around 4 months. Now I tried to work again on a project and also noticed I barely have any of the benefits of coc-flutter. I don't get analyzer indications, nor go to definition, nor auto-import or even completion from classes in the imports I already imported. I still get too the flutter service working and using CocCommand or CocList involving flutter all work, and also other "intellisense" completion work too (like methods in classes).

Another example of a basic feature not working is pressing K to get info on a symbol, I get:

Error on request (doHover): Vim(return):Error invoking 'doHover' on channel 4 (coc):
hover provider not found for current buffer, your language server doesn't support it.

To see if the issue is some weird interaction between some modules, I even started a new vimrc with just this:

call plug#begin(stdpath('data') . '/vim-plug-test-flutter')"
Plug 'dart-lang/dart-vim-plugin' " Dart programming language
Plug 'neoclide/coc.nvim', {'branch': 'release'} " CoC intellisense engine
call plug#end()

And then ran CocInstall coc-flutter using vim -u tmp-vimrc and then edited my flutter dart files. Still I'm getting this very reduced experience. coc is working perfectly fine with all other languages I use (python, rust, shell, JSON, etc.).

Any ideas on what could be going wrong and how to fix it is extremely appreciated, as this is making developing for flutter very old-school :)

$ flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on Debian GNU/Linux 11 (bullseye) 5.10.0-8-amd64, locale en_IE.UTF-8)
    • Flutter version 2.5.1 at /home/luca/software/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (2 days ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/luca/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /home/luca/software/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = chromium

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 11.0.1-2
    • cmake version 3.18.4
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 4.1)
    • Android Studio at /home/luca/software/android-studio
    • Flutter plugin version 53.1.1
    • Dart plugin version 201.9317
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux 11 (bullseye) 5.10.0-8-amd64
    • Chrome (web)    • chrome • web-javascript • Chromium 90.0.4430.212 built on Debian 11.0, running on Debian 11.0

• No issues found!
$ vim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-eK2ojg/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-eK2ojg/neovim-0.4.4/build/config -I/build/neovim-eK2ojg/neovim-0.4.4/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-eK2ojg/neovim-0.4.4/build/src/nvim/auto -I/build/neovim-eK2ojg/neovim-0.4.4/build/include
Compiled by team+vim@tracker.debian.org

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
Kavantix commented 2 years ago

Just released v1.9.6 which should fix these issues

dprophete commented 2 years ago

Very nice @Kavantix . Happy to report that it does indeed fix the issue. Thx.

llucax commented 2 years ago

Me too, thanks!

llucax commented 2 years ago

One question, since we are here and I don't know of a better place to ask. As part of my coming back to Flutter after a while being away, I updated to use the new flutter lints rules. I noticed I don't get the errors/warnings/info I get via flutter analyze inside vim with coc-flutter. Is this normal/expected? Is there a way to enable getting analyze issues as info/warn/errors in vim? I couldn't find any obvious options in this project's readme.

dprophete commented 2 years ago

@llucax : seems to work fine for me: image

llucax commented 2 years ago

Thanks for checking out. It's working for me now too, I'm not sure what happened, maybe a misconfiguration while I was trying to figure out why it didn't work before the update. But all good now 🎉