resharper-angularjs icon indicating copy to clipboard operation
resharper-angularjs copied to clipboard

Code completion and references for controllers

Open citizenmatt opened this issue 11 years ago • 1 comments

This PR is intended to hold the changes required to get ReSharper to understand controllers in angular.

Specifically:

  • Code completion in ng-controller and data-ng-controller attributes
  • Ctrl-click/goto definition navigation from the attribute value to the JS declaration of the controller
  • Renaming the controller should rename the attribute value
  • Find usages on the controller should highlight the attribute value, and vice versa

Steps to get this done (do not merge until done):

  • [x] Add a test project
  • [ ] Create an ICache implementation to parse all JS files in the solution and find controller declarations. See ReSharper's JavascriptTestCache implementation.
  • [ ] Write tests to validate the cache implementation
  • [ ] Create a reference provider that builds references on ng-controller and data-ng-controller attribute value tree elements. When resolving the reference, it looks up the controller in the cache. The reference allows navigation, find usages and renaming to work, and highlights when references can't be found
  • [ ] Write tests for the reference provider
  • [ ] Extend the reference provider to give code completion by implementing ICompletableReferenceProvider

The PsiPlugin sample in the SDK provides an implementation of ICache. Also, ReSharper's JavascriptTestCache class is a good example (dotPeek is your friend) - it parses JavaScript files to locate and cache tests.

The xunitcontrib project has an example of a reference provider to give code completion and navigation/find usages/renaming in a string literal in an attribute.

Note that this should support 7.1 as well as 8.0

citizenmatt avatar Jul 12 '13 16:07 citizenmatt

That's great a great Starting Point. Thanks,

DerAlbertCom avatar Jul 12 '13 18:07 DerAlbertCom