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

Made function 'start' in 'lua/flutter-tools.lua' public #429

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

obemu
Copy link
Contributor

@obemu obemu commented Jan 13, 2025

This PR changes the visibility of the function start in lua/flutter-tools.lua from private to public.

Currently, it is not possible to execute user commands from flutter-tools (FlutterRun, FlutterDebug, ...) before a .dart or the pubspec.yaml file has been entered. These commands can only be used once the start function, which registers them, is called. The problem is, that instead of calling start in setup, it is called once a .dart or the pubspec.yaml file is entered.

This change allows the user to call flutter.start() in their init.lua (or local .nvim.lua) file, to register all user commands. Therefore, the user is not required to enter a .dart/pubspec.yaml file to run their app and view log messages.

@sidlatau
Copy link
Collaborator

Registering commands in .nvim.lua is already supported via this pull request. I'm not sure if exposing the start function adds significant value. Could you elaborate on the specific use case this PR addresses?

@obemu
Copy link
Contributor Author

obemu commented Jan 14, 2025

I took a closer look at setup_project and found that I can achieve my desired outcome (being able to use the user commands without entering a .dart/pubspec.yaml file) by calling flutter.setup_project({}) in my init.lua. So accepting the PR would not add any new feature.

Nevertheless, I still think that there is some value in my approach, because I think that

local flutter = require("flutter-tools")
flutter.setup({ ... })
flutter.start()

semantically makes a lot more sense than

local flutter = require("flutter-tools")
flutter.setup({ ... })
flutter.setup_project({})

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.

2 participants