ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

tern_jump_to_def to another file #154

Closed mrkafk closed 7 years ago

mrkafk commented 7 years ago

Apparently the plugin can't find the definition in another file unless the definition has been sought for first in that other file.

Steps to reproduce:

  1. Create two files: a.js, b.js.

  2. Set a variable var colorValues = []; in a.js.

  3. Switch to file b.js.

  4. Restart ST3.

  5. In file b.js type colorValues and then try jumping to its definition (using alt+.) when cursor is on this word. Result: a popup "Could not find a definition".

It works when:

  1. Switch to file a.js, type colorValues, jump for the definition while cursor is on this word.

  2. Switch to file b.js, jump for the definition on colorValues typed in there. Result: ST3 switches to a.js and correctly places the cursor on the definition.

ST3, latest tern_for_sublime as of today. Platform: Ubuntu Linux x64.

marijnh commented 7 years ago

The server loads files lazily, so unless you've touched the file in this session, it won't know about it. You can use the loadEagerly config option or a module system to work around this.