No tags for angular modules
algorithmcardboard opened this issue · 6 comments
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?
As far as I can tell, that's tern's (the underlying parser) fault.
Is tern still the culprit?
I'm having the same issue. Any suggestion to solve it?
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.
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.
Excellent! One step closer - now we wait until someone has time / will to submit a PR