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

Autocompletion with multiple files #56

Closed
mklinga opened this issue Mar 29, 2014 · 2 comments
Closed

Autocompletion with multiple files #56

mklinga opened this issue Mar 29, 2014 · 2 comments

Comments

@mklinga
Copy link

mklinga commented Mar 29, 2014

Hi! I stumbled into a small issue. I think I'm best off showing how to reproduce it:

file1.js:

function A() { this.num = 1; }

file2.js:

var instance = new A();

now at file1.js:

instance.

provides no completion options even though :TernDef finds correct declaration in file2.js, and from there :TernDef finds function A() correctly in file1.js. After I have restarted vim (and thus tern server) with "loadEagerly": "*.js" completion in file1.js works as supposed to. Without loadEagerly this doesn't happen even if I open both files.

After reloading, completion on instance works until I change function A(). After that autocompletion can't find changed contents of instance anymore, which, I think, is understandable since it's now a different object.

So what I'm basically asking is if there is some way to "refresh" all files in the project for tern? Only relation between these files is that they happen to be in the same folder, so no require()-magic or anything like that.

@marijnh
Copy link
Member

marijnh commented Apr 16, 2014

Currently, killall node is the way to force a full reload. I wasn't able to reproduce this problem. The kind of circular dependency (file 1 using an instance from file 2 of a constructor it itself defines) is sort of rare, but theoretically, it should work (the new value for variable A should propagate to the new in file 2, and thus update the type of the object in instance). Are you using the current (git) version of Tern? There were some fixes to the mechanism that refreshes variables a few months ago.

@mklinga
Copy link
Author

mklinga commented Oct 6, 2014

Sorry for long delay in answering, this seems to be no longer relevant (I cannot reproduce the issue anymore), so this may be closed.

@mklinga mklinga closed this as completed Oct 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants