statelyai / xstate-tools

Public monorepo for XState tooling
183 stars 36 forks source link

Bug: VSCode visualizer doesn't resolve imported variables #490

Open adrianbw opened 3 months ago

adrianbw commented 3 months ago

When a state chart includes imported values, the visualizer doesn't seem to be resolving them, which makes the visualizer fail. This makes it really hard to share code across the various parts of our system. Given that the visualizer is a huge selling point, this is probably going to make me recommend not using xstate.

Here's without imports: without-imports

And with: with-imports

I've created a reproduction of this issue here: https://github.com/adrianbw/xstate-vscode-import-problem.

adrianbw commented 3 months ago

I'd be happy to try helping with this, but I'm having trouble getting the repo working with VSCode. If there are directions for that somewhere, I'd appreciate it.

nikuz commented 4 days ago

@davidkpiano this is actually a serious problem. I also prefer to keep my states as enums and action types outside of the state description to not bloat the state file. I guess this might be related to how the Stately.ai online editor works - it also expect all the variables defined in one file. But this limitation in VS Code makes it unusable for large projects.

I was going to adapt XState library and showcase the cool state charts to my team but now I can't do it without breaching our code organization guidelines.