Closed derekleverenz closed 11 years ago
As an addendum, this also seems to prevent jumping to definition. I'm not sure if this issue should be here or in the main tern project
If I paste your example into http://ternjs.net/doc/demo.html , it works fine.
Most likely, the problem is that you aren't loading the browser environment, and thus window
isn't bound to the top scope. Create a .tern-project
file to tell tern which environment to load. For example:
{"libs": ["browser"]}
Oh thanks, I did forget that. I had that in my main project but I think there was a problem with the way my project was configured, I was able to fix it though. Thanks!
As quick preface, I am not sure if this is a bug -- I may simply be expecting something from tern/tern_fo_vim that it isn't meant to do (also this might not be specific to vim)
Anyway, I have a large javascript project where individual files create objects and attach them to a global namespace. Here is a simplistic example of the structure (in concatenated form, as it would be in a browser, but it works the same if each part is in separate files in vim+tern_for_vim):
if run in a browser, this works as expected. However, tern's onmicompletion doesn't seem to be know about the properties (val1, f1, ...) of
objectOne
unless they are called within the file2.js function, and even then doesn't know any type information:In the above example, I expect that
val1
andf2
also appear as autocomletion options, and ideally also that those have type information.Am I simply misunderstanding functionality, or is this a real issue? It seems like there might be some issue with introspecting the way I am doing namespaces.