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

Reloading .tern-project #46

Open
ghost opened this issue Feb 28, 2015 · 2 comments
Open

Reloading .tern-project #46

ghost opened this issue Feb 28, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 28, 2015

Following on from dynamic config, I want to re-initialise tern if .tern-project has changed, or if one of my workspace plugin / lib files has changes.

This will allow my to develop tern and test tern configuration within brackets. I've got the logic to work out when I need to re-initialise, but don't see a clear way to do that. I see that the config is reloaded, but lib files changes I make are not reflected in the tooltips.

Is there a way to re-initialise tern in this instance? If not, let me know, and I'll do something.

@ghost
Copy link
Author

ghost commented Feb 28, 2015

ok, in fact, the issue only seems to be with lib files, I think require is caching the lib LocalServer.js:151 so it does not reload the text! if it's already loaded.

This is not an issue for plugin files, as they are loaded differently and reload automatically.

Any ideas here?

@MiguelCastillo
Copy link
Owner

@GabrielPage as you already found out, I am re-instantiating tern when the config file changes.

There is something here that I like. And it is to enable some generic way to watch file changes. Maybe adding a watch setting in .tern-project?

So here we can add another then step in the promise sequence probably called watch.

This is probably how the watch would register to watch for files.

And we would fire and event like analogous to this one.

The issue at this point would be requirejs that caches files, as you mentioned. I would be ok switching to a stream reader to load files, but the general use case needs the files cached. So we need a way to have a cache where items in it can be expired. Weakmaps would be REALLY nice here, but we dont have that yet in JavaScript.

I will think about this issue, but if you come up with something please don't hesitate to send a PR my way and we can work the kinks out. :)

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

1 participant