resharper-angularjs
resharper-angularjs copied to clipboard
option to create/navigate to a controller from ng-controller
Those are effectively two features, so I'm happy to split it into two requests:
One is to be able to write ng-controller="FooController"
or ng-controller="FooController as vm"
and have an option to alt + Enter
to create a new controller with this name.
Second one would be to navigate to definition when the controller exists.
This is similar to PR #11, which would add a reference between the value of the ng-controller
attribute and the controller function in JavaScript. Adding a reference enables the ctrl+click navigation, (mostly) code completion when editing, and partaking in renaming. @DerAlbertCom has done some work on this already - Albert, it would be great if you could do a new PR with your changes, even if they're unfinished.
The second part, create from usage, isn't covered and will have to be a separate piece of work. How would you expect it to work - where would it create the controller? In the HTML file, or in a new file, alongside, or in the scripts folder?
re: 2nd part
I realise that's not everybody's preference, but the way I structure the code is having them side by side:
/shoppingCart/
shoppingCart.html
shoppingCartController.js
That would obviously be my preference.
Is there a convention in angularjs world (I'm not familiar enough)?
I'm not sure,,, haven't seen any strong guidance around that, but I'm quite new to Angular myself, and figuring it out as I go
No it is not a convention. most from what i see put the view in seperate folders
@citizenmatt i think on the weekend i can work in the plugin
btw. the "other" guys uses often yeoman
For an example of the structure look here.
http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/
Hi @DerAlbertCom - any movement on the PR? I'm going to need an ICache implementation soon. I'm happy if you just want to push what you've got.
@citizenmatt my last work is on https://github.com/deralbertcom/resharper-angularjs
Some initial Cache implementation
https://github.com/DerAlbertCom/resharper-angularjs/tree/master/src/resharper-angularjs/JavaScript
and support for a solution specific xml with "own" directives.
https://github.com/DerAlbertCom/resharper-angularjs/blob/master/src/resharper-angularjs/Html/SolutionDeclaredElementsProvider.cs
@DerAlbertCom, are you ok if I cherry pick some of those commits? I want to get back onto this, but the project's changed a lot since the branch started, so I think it might be easier to pull in the most relevant commits and work from there. How does that sound?
Pick it.