Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flutter dependency detection #326

Conversation

mikeborodin
Copy link
Contributor

Flutter dependency detection

As mentioned in #282 the we need a better way to detect which configs to use - Dart or Flutter. This PR intents to do that by matching the consequent lines in pubspec.yaml

Test cases I checked:

  • Dart shelf example: has flutter = false
  • Flutter counter example: has flutter = true
  • Commented out 2 lines: has flutter = false
  • Changed spacing (still valid yaml): has flutter = true
  • Used tab instead of space: has flutter = true
  • Removed lines: has flutter = false

@akinsho
Copy link
Collaborator

akinsho commented Jan 22, 2024

@sidlatau thoughts? I haven't really worked with any non flutter dart projects

@sidlatau
Copy link
Collaborator

@sidlatau thoughts? I haven't really worked with any non flutter dart projects

LGTM. We already have PR with similar logic https://github.com/akinsho/flutter-tools.nvim/pull/292/files - but it is easier to understand regex here than in mentioned PR.
Not sure which one is more performant and if that matters here.

@mikeborodin
Copy link
Contributor Author

@sidlatau thoughts? I haven't really worked with any non flutter dart projects

LGTM. We already have PR with similar logic https://github.com/akinsho/flutter-tools.nvim/pull/292/files - but it is easier to understand regex here than in mentioned PR. Not sure which one is more performant and if that matters here.

Yes I saw that one but seems like there was no progress in some time and in my approach I intentionally don't keep the previous behavior.

Copy link
Collaborator

@akinsho akinsho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏾

@akinsho
Copy link
Collaborator

akinsho commented Jan 22, 2024

I imagine there might be some performance cost from using fn.glob and also fn.readfile as generally the fn.* methods do a trip through viml so are slower but I assume this function isn't called super often 🤷🏾‍♂️ we'll see

@akinsho akinsho merged commit 7f93847 into nvim-flutter:main Jan 22, 2024
3 of 4 checks passed
theniceboy added a commit to theniceboy/flutter-tools.nvim that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants