flutter-tools.nvim
flutter-tools.nvim copied to clipboard
prefer the dart binary located in dart_sdk rather than flutter_sdk
The flutter
package in nix doesn't expose the dart binary in <Flutter SDK>/bin/dart
. The binary is only found in the Dart SDK (<Flutter SDK>/bin/cache/dart_sdk/bin/dart
).
This PR prefers the dart binary located in the Dart SDK rather than the Flutter SDK.
Concers
This PR is ready to merge only if the dart binary is always located in the dart_sdk (which I'm pretty use is always the case, but idk).
If the dart_sdk path is found but there is no <dart_sdk>/bin/dart
then the plugin would fail to get the dart binary. That's because the PR doesn't check if the dart binary exists, only if paths.dart_sdk
doesn't exists then it checks paths.flutter_sdk
.
This seems potentially very risky and like it will introduce a bunch of problems for a plugin that is currently fairly stable. Can this not be solved in your config file by you just explicitly referencing where it should look for the binary. Tbh I haven't looked at all this logic in months so am defo rusty on the specifics.
This seems potentially very risky and like it will introduce a bunch of problems for a plugin that is currently fairly stable. Can this not be solved in your config file by you just explicitly referencing where it should look for the binary. Tbh I haven't looked at all this logic in months so am defo rusty on the specifics.
I could've just changed my Neovim config. But I wanted my Neovim to pick the Dart binary that is associated with the Flutter that is currently in PATH (because different projects have different flutter versions). Setting the location of the Dart binary in the Neovim config wont let me do it..
Just a thought, could you use the flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
configuration option to do what you're looking for. This could reference a small script in which you can stat for files and return the PATH which you feel is most appropriate.