Haul: Open File in Editor Support

Created on 15 Apr 2017  路  10Comments  路  Source: callstack/haul

In the React Native simulator, you can tap a stack frame and your editor will open to that file.

To do this, they POST to '/open-stack-frame' passing along {file, lineNumber}.

What happens next is kinda involved.

Supporting every single editor doesn't mentally scale, but maybe just offering a callback/plugin to haul where one could define their editor?

Would you guys be open to a PR supporting a dumbed down version of this to start?

Most helpful comment

Gonna leave this here. I know nothing about it... looks promising. as does everything when you don't install it.

Will tackle it this weekend. If someone beats me to it, that's 100% ok with me! :)

All 10 comments

Yeah, a PR will be great! Thank you.

Would you be open to a PR which just copy+pastes FB's code, retaining their BSD license in the header? I think adding a customisable solution would be nice eventually though.

I'd prefer to have an in-house solution for that particular problem. There are few concerns with how it's done right now with Packager as @skellock pointed out. I believe this gives us an opportunity to think about it.

Supporting every single editor doesn't mentally scale, but maybe just offering a callback/plugin to haul where one could define their editor?

Maybe ENV variable would do the trick

Ya my plan was to start with ENV but with a format string of sorts... each editor has slightly different ways to open with arguments... with a colon, with a space, with arguments.... and then there's VSCode :/.

I won't have time this week unfortunately, but I have a quiet weekend coming up. 馃帀

"plan b was to ask if you'd guys would be interested in a plugin system to extend the express middleware". - Captain ScopeCreep

@skellock yes, I was thinking about a similar thing, expose parts of haul as a set of express middlewares, which you can use in your own express server and add additional middlewares/wrap existing ones as you need.

Though we'd want to support most popular editors by default.

Well,

  • doesn't work at all <--- we are here
  • use opn (already a dep) and rely on the system?
  • read $EDITOR/$VISUAL/etc
  • provide a customizable ENV
  • provide a customizable ENV with a format string
  • auto-detect the shit out of it <--- we want to be here

Do you want to just maybe start on 2 or 3 (+ express middleware) and maybe have something more awesome next week?

AFAIK React Native Packager reads EDITOR and REACT_EDITOR, so we should probably do that.

Gonna leave this here. I know nothing about it... looks promising. as does everything when you don't install it.

Will tackle it this weekend. If someone beats me to it, that's 100% ok with me! :)

Was this page helpful?
0 / 5 - 0 ratings