Emacs – how to execute autocomplete queries in the background?

I'm very excited about Emacs autocomplete mode But my code base is very large. Sometimes, when I type, it will try to complete ssuggest. It searches all possible words and hangs It's annoying

Is there any way to run the search in the background parallel process, so Emacs will still respond to user operations And it is recommended to complete automatically only when the point is at this position at the end of the query?

Similarly, keyboard input is the main process, and will never be delayed, and is completed automatically as a residual on machine resources

Solution

Emacs Jedi is fully applicable to Python autocompletion You can use init property to send a request to the background process and store the result somewhere In candidate attributes, you can process stored results to pass them to autocomplete This is the AC source definition Please check the source for details

(ac-define-source jedi-direct
  '((candidates . jedi:ac-direct-matches)
    (prefix . jedi:ac-direct-prefix)
    (init . jedi:complete-request)
    (requires . -1)))

Emacs IPython notebook uses a similar technique, but I think Emacs Jedi is easier to read

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>