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

Support cross module parsing #31

Open
nicholas570 opened this issue Jan 11, 2022 · 6 comments
Open

Support cross module parsing #31

nicholas570 opened this issue Jan 11, 2022 · 6 comments

Comments

@nicholas570
Copy link

Config and options have to be written in the same file that declares the machine, to be found by the extension.

Example:

The visualizer can't find the machine
ext-import

The visualizer can find the machine
ext-no-imports

@Andarist
Copy link
Member

Could you expand on why do you want this feature? While some machines might not be loaded now because of that it's an easy refactor. So I assume that your intention is to keep machine configs outside of the createMachine call and I'm wondering why this is important for you.

@mattpocock
Copy link
Contributor

Having options outside of the same file as the config is sometimes useful - especially when the config is ~1000 lines long.

@Andarist
Copy link
Member

And that is already somewhat supported because createMachine doesn't require us to provide implementations right away. As you might suspect I'm just worried about the implications for syncing editor changes to source files if we'd allow this - because I'm worried that the "external" config in this example isn't a single self-contained node.

@nicholas570
Copy link
Author

Main reason is I'm working with several machines with complex and long config. As Matt said, in this case it's very useful to have options outside. It makes my machines much more readable and makes my development experience much better. Also for new comers, I noticed it was easier to get into machines and behaviors splitting the config and the options.

@Andarist
Copy link
Member

It's possible to createMachine in a single file and use machine.withConfig in another. Isn't this sufficient for your needs?

@nicholas570
Copy link
Author

Yeah it will be fine :)

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

No branches or pull requests

3 participants