amake / flutter.el

Flutter tools for Emacs
GNU General Public License v3.0
121 stars 11 forks source link

Test invocations fail on pure-Dart files in Flutter project #13

Open amake opened 4 years ago

amake commented 4 years ago

In an effort to support running tests in pure-Dart projects (because you may want to work on a pure-Dart project for use in a Flutter project), we try to be smart about which invocation to use: flutter test or pub run test.

But we are not smart enough: we assume a Flutter project only if the file has a import package:flutter(_test)?/... statement, and otherwise assume a Dart project.

This falls down for pure-Dart files in Flutter packages.

We need some cheap way of determining whether the project is a Flutter one or not.

ericdallo commented 4 years ago

The way VSCode dart extension and lsp-dart handles this is checking the pubspec.yml file on project root then searching for a flutter SDK regex dependency :) https://github.com/emacs-lsp/lsp-dart/blob/master/lsp-dart-utils.el#L44-L51

amake commented 4 years ago

Thanks! Yeah I was hoping for something possible without reading the contents of any files, but that does seem to be the most foolproof way.

ericdallo commented 4 years ago

Yeah, me too :sweat_smile: , but it seems to be working very well for VSCode