-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Ternjs Timeout configuration #1881
Comments
A workaround is to change the value of |
Why do you feel you need to change the timeout? Are you hitting a problem of some sort? Would be keen to understand the problem.
|
So, I'm going through an Ember book that has it's project source code here: https://github.com/abuiles/borrowers When I get home I'll edit this with the .tern-project that I'm using, but, completions take significantly longer than 0.5 seconds on any given file. |
Interesting, thanks. I'll take a look at it, as it will be a useful "large" javascript project to test with. TBH I don't think that a timeout of anything more that 0.5s is really a solution, in the sense that if you're not getting completions "instantly" then either ycmd or Tern are not really doing their job properly. Waiting for even 1/2 a second is a poor user experience. FWIW, the tern completer was using Tern's timeout option, but this was causing crashes in Tern. The crash fixed, but we haven't re-enabled the timeout yet, as ycmd has its own timeout mechanism. Using this large project as an example will help us determine what level of timeout, optimisation, etc. is required. In the meantime, if you're comfortable hacking ycmd, you can checkout tern master in |
@DonnieWest did you get round to digging out your |
Sorry! Here you go. A good portion of what you see here isn't necessary but is some of the hacking I've done to get tern.js to give halfway decent completions. Condensing ember.js also seems to work better in general, but still gives issues here
|
I am also keep getting timeout errors. After first error everything starts to lag and ycm is useless. Everything work fine before tern integration (with tern plugin). |
@sbuljac What do you mean "useless".
I don't think that this is the problem but could you try with regular vim? |
I think we need to update tern and add the tern timeout. I think tern server is spending too much time doing requests. See my post above for a workaround.
|
@puremourning even if we add Tern.js timeout how would it be useful when YCM still has a timeout of |
Please ignore my previous comment. It was Tern fault on the end, I made some config changes at the same time I recompiled Ycm, after timout message Ycm need a lot time to complete if at all... |
I mean it will limit cpu usage of tern server for a given request rather than unlimited. That leads to general better UX I believe.
|
FYI - i have tried the tern update to fixes crashes on timeouts, but it isn't working, so we're stuck with what we have for now. ternjs/tern#702 (comment) |
Well, definitely thanks for checking this out and all the effort you've put into it 👍 |
Is the recommended workaround still to edit |
[READY] Rewrite completion system There is a number of issues with the current completion system: - UI is blocked until the completions are returned by the server, the request timed out, or a key is pressed by the user. This leads to a rough experience when completions take too much time: cursor disappearing and timeout errors (see #2192 and #2574). Users even [increase the timeout by manually editing the `completion_request.py` file](https://github.com/Valloric/YouCompleteMe/blob/master/python/ycm/client/completion_request.py#L30) to avoid these errors, which exacerbate the issue and, in some cases, make the plugin unusable (see #2574). - no fuzzy matching from omnifunc when forcing semantic completion. See #961; - no fuzzy matching when deleting characters. Vim filtering is used instead: ![completion-bug-deleting-characters](https://cloud.githubusercontent.com/assets/10026824/26276156/f298c6de-3d71-11e7-92da-d22186239c27.gif) Neovim and MacVim are not affected. - completion menu disappears after deleting a character and inserting one: ![completion-bug-reinserting-character](https://cloud.githubusercontent.com/assets/10026824/26276192/b3ed0f7a-3d72-11e7-8c64-523a0a59cbdc.gif) Neovim and MacVim are not affected. - ignore the start column returned by the server. See PR #2489. - subject to flickers. This one depends a lot on the version of Vim. Completion is almost flicker-free in Neovim and MacVim. Not too bad in console Vim (except in fast terminal like [alacritty](https://github.com/jwilm/alacritty)). Awful in gVim GTK2 (a bit better on GTK3) and gVim on Windows. This PR is an attempt at fixing all of these issues while reducing flickers as best as possible (due to how completion works in Vim, a flicker-free experience is impossible to achieve). Here's how: - poll for completions using a timer and call `completefunc` once the completions are ready. Use the start column returned by the server in `completefunc`; - immediately display the last completions on the `TextChangedI` event to prevent the popup menu disappearing while waiting for the completions. This reduces flickering; - use the `InsertCharPre` event to close the completion menu just before inserting a character. This way the `TextChangedI` event is triggered when the character is inserted (this event is not fired when the completion menu is visible). This replaces the `refresh` option set to `always` in `completefunc` and the `s:cursor_moved` hack; - remap the backspace key to close the completion menu when deleting a character and thus triggering the `TextChangedI` event; - send a request with `force_semantic` set to `True` when forcing semantic completion instead of calling the omnifunc. This fixes the issue where there is no fuzzy matching for custom omnifuncs. Here's a demo where I added a spin animation on the command line while loading the completions to show that it doesn't block the Vim UI: ![async-completion-for-real](https://cloud.githubusercontent.com/assets/10026824/26277295/0f16a718-3d86-11e7-90f3-8a56bbf53f9f.gif) Fixes #961. Fixes #1282. Fixes #1881. Fixes #2192. Fixes #2500. Fixes #2574. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2657) <!-- Reviewable:end -->
In ternjs I can set the request timeout for the server like this:
let g:tern_request_timeout = 6000
Is there a way to configure ternjs like this in YouCompleteMe?
Edit: No there isn't. The reason this parameter exists in Tern is because of ternjs' relative slowness in parsing larger projects. With YouCompleteMe I'm now getting "Read timeout" errors that I didn't get with tern_for_vim.
Is there some other workaround or can we implement #742? Changing the timeout manually in the project seems to make this issue go away and give me proper completions
The text was updated successfully, but these errors were encountered: