tern.java icon indicating copy to clipboard operation
tern.java copied to clipboard

Improve performance with JS Editor and tern completion

Open angelozerr opened this issue 11 years ago • 7 comments

When completion is done, the full js content is sent to the tern server. It can be slow if js file is big. To fix this problem, "partial" tern doc should be managed (only sent the update of the js editor).

angelozerr avatar Jan 13 '14 20:01 angelozerr

I assume this should say "When editor is saved" instead of "When completion is done"?

p-bakker avatar Nov 26 '14 12:11 p-bakker

I assume this should say "When editor is saved" instead of "When completion is done"?

No. Today when completion, hyperlink, hover is done, the full JS content coming from the editor is posted to the tern server ("full" type is used for that).

With tern it's possible to post a "partial" JS content to execute completion, hyperlink, hover. This feature is interesting when the editor has a big JS. See http://ternjs.net/doc/manual.html and search "part"

angelozerr avatar Nov 26 '14 14:11 angelozerr

The completion with big file file like ember.js doesn't work because timeout is every time thrown because it takes too time to analyze the file.

If you take the demo http://ternjs.net/doc/demo/#simple and you copy/paste ember.js, teh first time completion is slow and teh second time it is fast, because it uses "part" file.

To add this feature inside tern.java, we need to know the start and end offset where update was done. To do that we must add a listener for IDocument to track sart + end offset.**My idea is to use TernDocumentFile and have ONE instance per editor of TernDocumentFile to add adocument listener to track start/end offset of the update (today we create an instance each time for completion, hyperlink)

@piotrtomiak are you OK to have ONE instance of TernDocumentFile per editor?

angelozerr avatar Jan 03 '16 16:01 angelozerr

@angelozerr - I have done support for part files through comparison. I will update you on whether we can contribute this.

piotrtomiak avatar Jan 07 '16 13:01 piotrtomiak

@piotrtomiak I'm sorry I have not understood? You have already implemented tern file "part" (see http://ternjs.net/doc/manual.html) instead of "full" (like today?). If it that and you can contribute it, it should really fantastic, otherwise I will implement it and are you OK to have ONE instance of TernDocumentFile per editor?

angelozerr avatar Jan 07 '16 13:01 angelozerr

@angelozerr yeah, exactly. Not much coding :) I will create PR soon, today or tomorrow morning.

piotrtomiak avatar Jan 07 '16 16:01 piotrtomiak

@angelozerr yeah, exactly. Not much coding :) I will create PR soon, today or tomorrow morning.

Wow, very cool! I'm very exciting with your PR:) Thanks!

angelozerr avatar Jan 07 '16 16:01 angelozerr