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

No tags for angular modules #7

Open
algorithmcardboard opened this issue Apr 18, 2014 · 6 comments
Open

No tags for angular modules #7

algorithmcardboard opened this issue Apr 18, 2014 · 6 comments

Comments

@algorithmcardboard
Copy link

I have a js file that defines angularjs controllers, directives. When I run jsctags for that file it always outputs empty array.

var app = angular.module('TesetModule', ['LocalStorageModule']);

app.config(["$httpProvider", function(provider) {
  "use strict";
  provider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content');
  provider.responseInterceptors.push('authenticationInterceptor');
}]);

app.run(["$rootScope", "$window", function($rootScope, $window){
  $rootScope.saluteUser = function (){
    if($window.gon.f_n){
      return "Hi "+$window.gon.f_n;
    }
    return "Hi";
  };
}]);

From my terminal:

$ jsctags app.js
[]

Is this expected?

@srathbun
Copy link

As far as I can tell, that's tern's (the underlying parser) fault.

@faceleg
Copy link
Collaborator

faceleg commented Sep 24, 2015

Is tern still the culprit?

@lvarayut
Copy link

I'm having the same issue. Any suggestion to solve it?

@faceleg
Copy link
Collaborator

faceleg commented Oct 11, 2015

Someone needs to determine whether it is tern or this module that is causing this, then submit a PR to solve whatever issue it is.

@herrernst
Copy link
Contributor

Hi,
I've added the source code from the first comment to angular-test.js and run tern's condense (tern@0.15.0) command (which outputs code structure in JSON) as node_modules/tern/bin/condense --plugin angular angular-test.js:

{
  "!name": "angular-test.js",
  "!define": {
    "!ng": {
      "TesetModule": "app"
    }
  },
  "app": {
    "!proto": "angular.Module.prototype",
    "!span": "4[0:4]-7[0:7]",
    "!data": {
      "includes": [
        "LocalStorageModule"
      ]
    }
  }
}

So I think tern "understands" angular, but jsctags doesn't use/interpret tern's output.

@faceleg
Copy link
Collaborator

faceleg commented Oct 13, 2015

Excellent! One step closer - now we wait until someone has time / will to submit a PR

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

No branches or pull requests

5 participants