[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the most useful potential feature which Emacs lacks? A: Auto
Re: What is the most useful potential feature which Emacs lacks? A: Autocompletion
Wed, 03 Jun 2020 17:40:30 +0300
On Wed, 2020-06-03 at 17:21 +0300, Dmitry Gutov wrote:
> 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
> 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
> company issue tracker. But it's a balancing act. Set the value too
> -- and the result is more likely to annoy people who don't rely on
> 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
I mean, I was typing outside Emacs, in the same terminal where
`libinput debug-events` was running. I was just testing how fast I can
type, to figure out how small the timeout should be set if I want a
completion to pop up.
> > > 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.
Well, I paused the backing server in the steps above, so server
couldn't answer. This was emulating a behaviour where a user works with
a project too big for backend to return a completion immediately.
Expected behaviour was that I should not get any lags while typing, and
there were no lags.
> > 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"
> API for Emacs (which we want to integrate with) still only supports
> synchronous convention.
I am a bit confused by the last sentence. What's the relation between
the Emacs API and already working company-mode? Did you mean, company-
mode is trying to be compatible with backends for some standard Emacs
API, and those can't be async?
RE: What is the most useful potential feature which Emacs lacks? A: Autocompletion, Drew Adams, 2020/06/03