-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
racer starts when cursor resting at pos 0 and locking up the UI for seconds.. #97
Comments
Adding: Setting company idle time or minimum chars does not help. |
Even though I know nothing about lisp I couldn't help myself and debugged a bit. Problem seem to be that this function Commenting out that line at least makes Emacs usable again. |
The problem I think is that this uses company's capf, which blocks emacs, rather than running asynchronously. |
Experiencing the same issue on:
I have a feeling this isn't company but Eldoc that's doing it, though. Turning it off seems to alleviate the problem. IIUC emacs-racer ends up calling |
After some thumbing around I believe either use std::collections::HashMap::| command being sent to VLADILENs-MacBook-Pro-93:.emacs.d russki$ racer complete 1 31 /Users/russki/Code/try_rust/src/main.rs /Users/russki/Code/try_rust/src/main_copy.rs
PREFIX 31,31,
^C I observed it with VLADILENs-MacBook-Pro-93:.emacs.d russki$ racer complete std::collections::HashMap::
--- list of associated functions --- FWIW I tried rewriting Here's the code to play with: (defmacro racer--with-temp-buffers (buffer-names &rest body)
(declare (indent 1))
`(let ((kill-buffer-query-functions nil))
,@(-reduce-r-from (lambda (buffer body)
(list
`(with-temp-buffer
(setq ,buffer (current-buffer))
,@body)))
body
buffer-names)))
(defcustom racer-command-timeout nil
""
:type 'number
:group 'racer)
(defun racer--shell-command (program args)
"Execute PROGRAM with ARGS. Return a list (exit-code stdout
stderr)."
(racer--with-temp-buffers (stdout stderr)
(let (exit-code
stdout-result
stderr-result
(proc (make-process :name "*async-racer*"
:buffer stdout
:command (cons program args)
:connection-type 'pipe
:stderr stderr))
(start-time (float-time)))
(while (and
(process-live-p proc)
(< (- (float-time) start-time) (or racer-command-timeout 0.1)))
(accept-process-output proc))
(when (process-live-p proc) (kill-process proc))
(setq exit-code (process-exit-status proc)
stderr-result (with-current-buffer stderr (buffer-string))
stdout-result (with-current-buffer stdout (buffer-string)))
(setq racer--prev-state
(list
:program program
:args args
:exit-code exit-code
:stdout stdout-result
:stderr stderr-result
:default-directory default-directory
:process-environment process-environment))
(list exit-code stdout-result stderr-result)))) I might look into it further if Rust clicks and I start using it more. Hope ^ wasn't completely useless. Thank you for |
You can "cure" the above mentioned (accept-process-output proc (or racer-command-timeout 0.1)) |
This commit replaces blocking `call-process` with asynchronous `make-process`. Instead we block explicitly until racer process output is received or timeout fires. To that effect we introduce two new custom variables `racer-command-timeout` and `racer-eldoc-timeout`. The latter is important because Eldoc runs every time Emacs is idle but the user should be able to start typing any time without waiting on the racer process. Timeout value of nil will wait for the output indefinitely. I observed that the first time `racer` shell process runs it may take a while to respond probably due to indexing. Following responses tend to be snappy. For that reason and because user asking for completion is likely ok with a bit of waiting `racer-command-timeout` defaults to nil. `racer-eldoc-timeout` however should be fairly low. How low depends on your machine, etc. Value of 0.1 was too short on my machine, but 0.5 seems to work fairly reliably. Hopefully fixes racer-rust#97
This may also alleviate #86 and #91 which didn't come up in my initial search, sadly. My experiments with command line |
As the title says. This is extremely annoying since the UI is frozen for seconds every time I stop with the cursor at for example pos 0 on a line like:
pub struct .....
racer seem to activate if I rest with the cursor for more than ~1 second. racer is using 100% CPU for at least one second and emacs is frozen during this time.
rust/racer etc everything latest version and config according to documentation.
emacs 25.3
FreeBSD
The text was updated successfully, but these errors were encountered: