0

In my tern set up in emacs, this code works fine when I do M-. when my cursor is under the foo of obj.foo() (in the last line):

var obj = {};
obj.foo = function() {
    return true;
};

obj.foo();

But when I do the same on the following, it says "No definition found."

window.obj = {};
obj.foo = function() {
    return true;
};

obj.foo();

I tried making each refernce to obj as window.obj. Doesn't seem to help. Am I missing something?

viky
  • 542
  • 1
  • 7
  • 19
  • To be clearer, you might want to edit your question for typos. For example: `util.foo`? And be specific about where you are using `M-.` etc. – Drew Apr 04 '15 at 22:09

2 Answers2

1

It seems that your problem is that you don't use browser JSON Type Definition which defines window object. Your .tern-project should look like this :

{"libs":["ecma5","browser"]}

I have tried without browser and I have the same problem than you. If I declare browser, it works great.

Angelo
  • 2,027
  • 13
  • 17
0

I assume you are saying that what doesn't work is to put the cursor on window.obj and hit M-.. To find the corresponding definition, M-. needs to have it indexed in a TAGS file. If that has not been done then you are out of luck: it won't be recognized.

See the Emacs manual, node Tags and its children, particularly node Create Tags Table.

Drew
  • 29,895
  • 7
  • 74
  • 104