tern icon indicating copy to clipboard operation
tern copied to clipboard

Tern not able to refer variables in other files

Open mnadeem opened this issue 8 years ago • 5 comments

Apple.js

var apple = (function () {
	return {
		init : function() {
			
		}
	};
	
})();

AppleEater.js

//cant navigate from AppleEater.js to Apple.js, when either clicked on `apple` or `init`
apple.init();

mnadeem avatar Apr 25 '17 18:04 mnadeem

Cant do the following as well

Apple.js

function Apple() {}

AppleEater.js

//cant navigate from AppleEater.js to Apple.js, when clicked on Apple
var apple = new Apple();

mnadeem avatar Apr 25 '17 18:04 mnadeem

Do you have a module system plugin enabled, either in .tern-project or .tern-config?

marijnh avatar Apr 25 '17 20:04 marijnh

I have used Eclipse, and added those scripts in the following preference=>javascript=>Tern=>Scriptpaths

Not sure if those would get created automatically

mnadeem avatar Apr 26 '17 09:04 mnadeem

I'm also able to reproduce this;

it seems when using the webpack plugin with a reasonably deep folder structure (5 levels or so) tern refuses to load resolved files.

Debugging the webpack plugin, the resolve step occurs and correctly resolves the file that the referred symbol exists in, however tern doesn't seem to do anything with this.

By doing a files request, we can see that the referred file isn't loaded.

However, by turning on eager loading, this is resolved and tern has no issues resolving the symbol in the second file. Additionally, without eager loading this can be resolved by modifying the second file.

I will try get an example together to reproduce this functionality.

I would happily just use the loadEagerlyoption to fix my problems, however since the codebase I work on is so large, I am unable to eagerly load all files (hitting OS open file limits on tern bootup)

nickw444 avatar May 27 '17 04:05 nickw444

Example repo here:

https://github.com/nickw444/tern-demo. Readme explains how to reproduce.

nickw444 avatar May 27 '17 09:05 nickw444