|
From: | Dmitry Gutov |
Subject: | Re: What is the most useful potential feature which Emacs lacks? A: Autocompletion |
Date: | Wed, 3 Jun 2020 17:21:44 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 03.06.2020 16:59, Konstantin Kharlamov wrote:
I am not sure why you say it seems wasteful. Do you mean perhaps, as opposed to setting, say, 100ms?
Or 50ms, maybe.Wasteful of CPU cycles and laptop battery, I'd say. Of course, the exact impact depends on the size of your project.
100ms I think is the top limit this timeout should be set.
The defaults are not set in stone, we can discuss changing them on the company issue tracker. But it's a balancing act. Set the value too small -- and the result is more likely to annoy people who don't rely on the popup as much.
I just tested how quickly I can type a string "prog". I fired up `libinput debug-events` and tried to type "prog". The letter "g" says "+0.256s", i.e. it took 256ms. This means even if I set to 100ms, there's high chance I won't get any autocompletion.
Should I take this to mean the completion request itself took 156ms to finish?
To be 100% sure, you should try it yourself (I don't do C/C++). Maybe someone else here can testify, though.Thank you! Indeed, I confirm this does seem to work with an async backend. I tested it as follows: 1. Opened a test.cpp file, enabled company-irony, checked that completion works. 2. I set `(setq company-idle-delay 0)` 3. I paused the irony-server process with `kill -SIGSTOP $(pidof irony-server)` 4. I tried typing a gibberish to see if I get any delay in rendering a text. I don't see any lags, so I assume using an async backend with the timeout set to 0 should work fine.
Indeed, that's what asynchronous means. But the quality of the user experience also depends on how quickly the backing server can handle those requests.
This is great news! I wonder if company mode should default to zero or so timeout, and print a warning if somebody tries to connect a non-async backend?
The majority of backends are synchronous. And the "standard" completion API for Emacs (which we want to integrate with) still only supports the synchronous convention.
[Prev in Thread] | Current Thread | [Next in Thread] |