help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Too long completion delay time in LISP interaction mode.


From: Hongyi Zhao
Subject: Re: Too long completion delay time in LISP interaction mode.
Date: Thu, 21 Oct 2021 14:14:15 +0800

On Thu, Oct 21, 2021 at 1:47 PM Tassilo Horn <tsdh@gnu.org> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> >>   (setq completion-category-overrides
> >>         '((project-file
> >>            (styles partial-completion substring initials))
> >>           (file
> >>            (styles partial-completion substring initials))
> >>           (eglot
> >
> > Can the above line be changed into the following?
> >
> >              ((eglot lsp)
>
> The docs suggest that the keys are one CATEGORY, not a list of
> categories.  But you can duplicate the eglot entry for lsp,

Thank you for pointing this out.

> assuming that lsp-mode defines its own completion category which I don't know
> (since I use eglot for my LSP interaction).

They are defined as follows:

https://github.com/emacs-lsp/lsp-mode/blob/1ece3b81ad10d1b10a2c73c6617b4426e673cbc7/lsp-completion.el#L745

(make-local-variable 'completion-category-defaults)
(setf (alist-get 'lsp-capf completion-category-defaults) '((styles .
(lsp-passthrough))))


https://github.com/emacs-lsp/lsp-mode/blob/1ece3b81ad10d1b10a2c73c6617b4426e673cbc7/lsp-completion.el#L775

(setq-local completion-category-defaults
(cl-remove 'lsp-capf completion-category-defaults :key #'cl-first))


So, I adjusted to the following configuration based on orderless package:

(use-package orderless
  :config
  ;; https://github.com/oantolin/orderless#ivy
  (setq ivy-re-builders-alist '((t . orderless-ivy-re-builder))
    completion-styles '(partial-completion substring flex orderless)
    completion-category-overrides
    '((project-file
       (styles partial-completion substring initials))
      (file
       (styles partial-completion substring initials))
      (eglot
       (styles partial-completion substring))
      (lsp
       (styles partial-completion substring))
      )))

HZ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]