ember_tools.vim
ember_tools.vim copied to clipboard
Add support for gf for route-action in templates
See https://github.com/DockYard/ember-route-action-helper.
This addon adds support to use a helper called route-action which creates an action that send it directly to the route instead of the controller. Would be awesome to get that working using gf to go the action definition at the route.
Hmm, it would be very convenient, but it is an addon, so I'm not sure if it makes sense to hardcode it into the plugin. I would actually prefer that I create some extension that allows people to specify helpers like this easily. It would also help with custom helpers, say, if you're writing your own navigation helpers or something.
There's already a way to create custom gf callbacks by changing the g:ember_tools_custom_gf_callbacks variable, but that would imply writing a function for it, and some of the tools to find routes and such are private functions. For one thing, I should probably improve the API to make this kind of thing easier, but it might be possible to simplify this particular use case. I'll see if I can come up with something.
I noticed that if I use gf on an (action ... in a component's hbs file I only get the error:
E447: Can't find file "removeUser" in path
removeUser is indeed defined in the component's actions hash. Do I need to configure something to get this to work?
@ctataryn This seems like a bug, but it's difficult for me to debug without a more detailed example. Could you give me the full line of code that you're using gf on, where the cursor is, and what the relevant filenames are? I'd like to see if I can reproduce the issue.