iamcco / coc-flutter

flutter support for (Neo)vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`TypeError: t.find is not a function` when saving a dart file

dprophete opened this issue · comments

Describe the bug

I got coc-flutter working properly with my neovim setup. I love it. Code completion, goto def, find references, hot reload, etc... everything works fine.

Except for one little thing. Whenever I save a dart while WHILE the app is running (say, in the simu), I get this vim error:

[coc.nvim]: TypeError: t.find is not a function
    at /Users/didier/.config/coc/extensions/node_modules/coc-flutter/out/index.js:33:52359
    at pq.invoke (/Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:35:9670)
    at Dd.fire (/Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:35:10436)
    at E4.onBufWritePost (/Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:191:3828)
    at /Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:68:3728
    at new Promise (<anonymous>)
    at a (/Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:68:3680)
    at /Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:68:3379
    at Array.map (<anonymous>)
    at aB.fire (/Users/didier/Dropbox/shared/dda_config/dot-files/dot-vim/plugged/coc.nvim/build/index.js:68:3372)

And if I stop/detach the app, then saving works fine.

To Reproduce
For me it's quite simple:

  • start the app with CocCommand flutter.run
  • open a dart file from this app (say, main.dart)
  • save the file (`:w)

Desktop (please complete the following information):

  • OS: mac os big sur 11.5.1 (20G80)
  • Vim or Neovim: neovim
  • (Neo)vim version: NVIM v0.6.0-dev+75f758b99

Output channel:

  1. Set "flutter.trace.server": "verbose"
  2. Restart coc using :CocRestart
  3. Reproduce the issue
  4. :CocCommand workspace.showOutput open output list and select flutter

Paste Log from above:

[dev-command]: register dev command
[sdk]: which flutter command => /Users/didier/tmp/flutter/bin/flutter
[sdk]: flutter command path => /Users/didier/tmp/flutter/bin/flutter
[sdk]: dart sdk home => /Users/didier/tmp/flutter/bin/cache/dart-sdk
[sdk]: analyzer path => /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot
[sdk]: dart command path => /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/dart
[fs]: executing command /Users/didier/tmp/flutter/bin/cache/dart-sdk/bin/dart --version
[sdk]: dart version: v2.13.4
[lsp-server]: rightVersion true
[lsp-server]: analysis server ready!
[lsp-closing-labels]: register closing labels
[dev-command]: run dev server, devServer state: false
[dev-command]: run dev server, devServer state: false
[server]: server start at: /Users/didier/dev/flutter-runtime
[dev-command]: register commands

And here is from the tsserver:

[Info  - 10:54:55 AM] using npm from /usr/local/bin/npm
[Info  - 10:54:55 AM] Forking TSServer
PATH: /Users/didier/.opam/4.12.0/bin:/Users/didier/bin:/Users/didier/Dropbox/shared/dda_bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin:/Users/didier/.cargo/bin:/usr/local/go/bin:/Users/didier/go/bin:/Users/didier/tmp/flutter/bin:/Users/didier/tmp/google-cloud-sdk/bin:/Users/didier/.fzf/bin 
[Info  - 10:54:55 AM] Started TSServer
{
  "path": "/Users/didier/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib",
  "_pathLabel": "",
  "_api": {
    "versionString": "4.2.2",
    "version": "4.2.2"
  }
}

Config
If you have any config for this specific extenstion in you coc-settings please include them here.

some more details:

>> node --version
v14.17.5

>> npm --version
7.20.6

>> flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale en-ES)
    • Flutter version 2.2.3 at /Users/didier/tmp/flutter
    • Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/didier/Library/Android/sdk
    • Platform android-31, build-tools 30.0.2
    • ANDROID_HOME = /Users/didier/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/didier/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 59.0.4
    • Dart plugin version 212.4746.57

[✓] VS Code (version 1.39.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.4.1

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (3rd generation) (mobile) • 2D658C4A-81FA-405B-989B-54E15140AC09 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)                              • macos                                • darwin-x64     • macOS 11.5.1 20G80 darwin-x64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 92.0.4515.159
    ! Error: dda iphone x is not connected. Xcode will continue when dda iphone x is connected. (code -13)

forgot to mention that I am only getting this with coc-flutter. I use coc with elm or js, and I am not getting any error there...

What's your coc-flutter version. The bug is fix in the latest version.

oh man, of course... Ok, I did a quick CocUpdate and now life is good. Thx a lot @iamcco. Really appreciate the quick answer.