Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.
This repository was archived by the owner on May 25, 2019. It is now read-only.

ng-controller doesn't suggest my controller name #67

Open

Description

@gplusdotgr

Hello.

I have autocomplete enabled, I index my project, but I only get as suggestions the controllers declared inside the angular core libraries, I don't get the one I just wrote:

screen shot 2014-09-14 at 23 17 38 2

websiteApp.controller('SpicyController', ['$scope', function($scope) {
    $scope.spice = 'very';

    $scope.chiliSpicy = function() {
        $scope.spice = 'chili';
    };

    $scope.jalapenoSpicy = function() {
        $scope.spice = 'jalapeño';
    };
}]);

Activity

  1. subhaze commented on Sep 14, 2014

    @subhaze
    Contributor

    This is due to how the files are parsed. To reduce false positives on matching directives/controllers/etc the plugin looks for angular/app/etc so if you're naming your app something other than "app" you'll need to update the regex in the settings file.

    https://github.com/angular-ui/AngularJS-sublime-package#indexing-options

    In your case you'd need to change app to websiteApp or rename websiteApp to just app

  2. gplusdotgr commented on Sep 15, 2014

    @gplusdotgr
    Author

    Thanks. I added
    "((^[ \t].{0}|^[ \t]{0}|angular.{0}|).{0}|app.{0})[ ]([ ]["'])([\w.$]*)(["'])"
    and changed the match_expression_group to 4, but I still get the same results... (reindexed)
    What's the regex to have fooApp ?
    Could it have to do with my folder structure?

  3. subhaze commented on Sep 15, 2014

    @subhaze
    Contributor

    Didn't notice that in the screen shot. It's possible, I'll have to look into that.

  4. gplusdotgr commented on Sep 15, 2014

    @gplusdotgr
    Author

    I'm actually not so sure I used the right regex, could you clarify?

  5. subhaze commented on Sep 15, 2014

    @subhaze
    Contributor

    @gkatsanos, yeah, looks like you missed updating the app part. Sorry was about to run out the door when I responded so didn't have time look over this thoroughly.

    This:

    // {0} is the location of where the definition name will be inserted
    // ex: directive
    "match_expression": "((^[ \\\\t]*\\.{0}|^[ \\\\t]*{0}|angular\\.{0}|\\)\\.{0}|app\\.{0})[ ]*\\([ ]*[\"\\'])([\\w\\.\\$]*)([\"\\'])",
    
    "match_expression_group": 3
    

    should be this:

    // {0} is the location of where the definition name will be inserted
    // ex: directive
    "match_expression": "((^[ \\\\t]*\\.{0}|^[ \\\\t]*{0}|angular\\.{0}|\\)\\.{0}|(app|websiteApp)\\.{0})[ ]*\\([ ]*[\"\\'])([\\w\\.\\$]*)([\"\\'])",
    
    "match_expression_group": 4
    

    And you'll need to restart ST before doing the reindexing.

  6. gplusdotgr commented on Sep 15, 2014

    @gplusdotgr
    Author

    is there a way to use a wildcard of some type so that all *App names are picked-up?

  7. subhaze commented on Sep 15, 2014

    @subhaze
    Contributor

    Sure, if you'd like. It's converted down into a regex. So anything you can do via Regex in Python is doable there.

  8. gplusdotgr commented on Sep 15, 2014

    @gplusdotgr
    Author

    I can't really do Regexes :) Wouldn't it be helpful to make it by default catch all names that end on "app" ?

  9. subhaze commented on Sep 15, 2014

    @subhaze
    Contributor

    @gkatsanos sounds reasonable.

    I've been considering always going with the second method and exposing an array that you can tweak so it's easier to change the behavior. This should be a pretty safe update so I'll try to hammer something out this week and push an update out.

  10. gplusdotgr commented on Sep 15, 2014

    @gplusdotgr
    Author

    Listen if you don't have time I can try to make a pull request myself, I have some time following weekend.

  11. subhaze commented on Sep 15, 2014

    @subhaze
    Contributor

    That'd be very welcomed. I'll still try and find some time this week, but if you can get to it'd be appreciated.

  12. charlesmudy commented on Feb 16, 2015

    @charlesmudy

    Hi guys, any update on this?

  13. subhaze commented on Feb 17, 2015

    @subhaze
    Contributor

    I've been slammed with work, per usual, but the adjustments to the config shown above should allow you to make any tweaks needed until updated to be more user friendly. I can't say when, but I'm really wanting to get a day or two set aside to fix reported issues, and produce a new release...

  14. added a commit that references this issue on Feb 17, 2015
    d212aac
  15. tej-rana commented on Oct 26, 2015

    @tej-rana

    I can't get this to work.

    Here's my app definition
    angular.module('BookStoreApp', ['ionic', 'BookStoreApp.controllers', 'BookStoreApp.factory'])

    and here's my user settings

    {

    // {0} is the location of where the definition name will be inserted
    // ex: directive
    "match_expression": "((^[ \t].{0}|^[ \t]{0}|angular.{0}|).{0}|BookStoreApp.{0})[ ]([ ]["'])([\w.$]*)(["'])",

    // what group to expect the name in
    // ex: module('myApp')
    // myApp is currently in group 3 of the current 'match_expression'
    "match_expression_group": 4,
    
    
    "match_definitions": ["controller", "directive", "module", "factory", "filter"],
    
    //indexing your project should get you more updated completions
    "enable_AngularUI_directives": true
    

    }

    When I type

    The status message says no available completion.

  16. tej-rana commented on Oct 26, 2015

    @tej-rana

    I can't get this to work.

    Here's my app definition
    angular.module('BookStoreApp', ['ionic', 'BookStoreApp.controllers', 'BookStoreApp.factory'])

    and here's my user settings

    {

    // {0} is the location of where the definition name will be inserted
    // ex: directive
    "match_expression": "((^[ \t].{0}|^[ \t]{0}|angular.{0}|).{0}|BookStoreApp.{0})[ ]([ ]["'])([\w.$]*)(["'])",

    // what group to expect the name in
    // ex: module('myApp')
    // myApp is currently in group 3 of the current 'match_expression'
    "match_expression_group": 4,
    
    
    "match_definitions": ["controller", "directive", "module", "factory", "filter"],
    
    //indexing your project should get you more updated completions
    "enable_AngularUI_directives": true
    

    }

    When I type

    The status message says no available completion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions