Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code completion and references for controllers #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

citizenmatt
Copy link
Member

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):

  • 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

@DerAlbertCom
Copy link
Contributor

That's great a great Starting Point. Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants