universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
326 stars 26 forks source link

company auto completion lag on Windows #70

Closed kaiwk closed 3 years ago

kaiwk commented 3 years ago

I'm using Emacs 27.2 on Windows 10, minimum config to reproduce with chromium repo:

;;; straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(setq straight-vc-git-default-clone-depth 1)
(defalias 'straight! 'straight-use-package)

(straight! 'company)
(straight! '(citre :host github :repo "universal-ctags/citre" :branch "develop"))

(global-company-mode)

(require 'citre)
(require 'citre-config)

19-49-42


previous discussion

AmaiKinono commented 3 years ago

Additional info: the tags file is generated by:

$ ctags --languages=C,C++ -R .

To stop Emacs from thinking it's a etags TAGS file, we can do:

(setq company-backends '(company-capf))

I can reproduce this. If I delete E, wait for a little moment, then hit <backspace> one or several times, Emacs is frozen.

I did M-x list-processes several times. It still looks like there are readtags processes that aren't correctly cleaned up (definitely related to https://github.com/universal-ctags/citre/issues/69).

Maybe one fix is to kill existing readtags processes before starting a new one. But let me think more about it.

Edit: I can confirm:

to kill existing readtags processes before starting a new one

Fixes the problem. It still lags a little bit when deleting t, but Emacs won't freeze. I guess that's just the Windows thing.

AmaiKinono commented 3 years ago

I got good news for you ;)

In the latest develop branch, I've completely reworked the polling mechanism.

If I understand it correctly, the responsiveness of the new method reaches the theoretical limit: Whenever Emacs allows user input, you can just type.

Test on my machine using your recipe:

windows-new-fix

kaiwk commented 3 years ago

It works pretty good! Now I can type smoothly.

I'll close the issue since it has been resovled. Anyone has any other thoughts can reopen it.

AmaiKinono commented 3 years ago

Thanks for testing!

I'll do some cleanup and merge it to master this evening.