dart-vim-plugin icon indicating copy to clipboard operation
dart-vim-plugin copied to clipboard

DartFmt deletes everything from the buffer

Open habamax opened this issue 5 years ago • 4 comments

  • Win10
  • gVim/vim 8.1.2269

vim-dartfmt

habamax avatar Nov 09 '19 17:11 habamax

Thanks for reporting this!

This used to be the case when there was a syntax error in the Dart code but I thought we’d fixed this a while back.

Specifically the reason I remember it happening before was that dartfmt relies on the analyzer package to build an AST, and in the case where there’s a syntax error the analyzer couldn’t parse it, so dartfmt would exit with no output. I thought we’d fixed that by only doing the replacement if the exit code was zero.

Hard to tell if there’s a syntax error in the above code from my phone — I assume there’s a closing curly bracket on main() that’s offscreen — but either way that shouldn’t be happening. Will see if I can repro. If it turns out to be Windows-specific I’ll probably need some help as I don’t have access to a Windows machine.

cbracken avatar Nov 09 '19 18:11 cbracken

Will see if I can repro. If it turns out to be Windows-specific I’ll probably need some help as I don’t have access to a Windows machine.

Sure, let me know what to do.

habamax avatar Nov 09 '19 18:11 habamax

This used to be the case when there was a syntax error in the Dart code but I thought we’d fixed this a while back.

It actually happens for all dart files, even the simplest hello world from dart examples.

habamax avatar Nov 09 '19 18:11 habamax

same issue win 10 gvim8.2

Chaitanyabsprip avatar Dec 13 '20 20:12 Chaitanyabsprip