2

I'm trying to set up racer mode for Rust language autocomletion, but when press 'tab' key got messages like this:

Company: An error occurred in auto-begin
Company: backend company-capf error "/cygdrive/d/Soft/Cygwin64/home/racer/target/release/racer exited with status 1" with args (candidates B)
Company: An error occurred in auto-begin
Company: backend company-capf error "/cygdrive/d/Soft/Cygwin64/home/racer/target/release/racer exited with status 1" with args (candidates B)
Company: An error occurred in auto-begin
Company: backend company-capf error "/cygdrive/d/Soft/Cygwin64/home/racer/target/release/racer exited with status 1" with args (candidates B)

Here is my .emacs:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)


(setq company-tooltip-align-annotations t)

(setq racer-cmd "/cygdrive/d/Soft/Cygwin64/home/racer/target/release/racer")
(setq racer-rust-src-path "/home/rust/src/")

(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)

(add-hook 'racer-mode-hook #'company-mode)

(global-set-key (kbd "TAB") #'company-indent-or-complete-common) ;

(defun rust-save-compile-and-run ()
  (interactive)
  (save-buffer)

  (if (locate-dominating-file (buffer-file-name) "Cargo.toml")

      (compile "cargo run")

    (compile
     (format "rustc %s & %s"
         (buffer-file-name)
         (file-name-sans-extension (buffer-file-name))))))

(add-hook 'rust-mode-hook
      (lambda ()
        (define-key rust-mode-map (kbd "<f5>") 'rust-save-compile-and-run)))

Any help would be appreciated.

UPDATE:

So, when i try to call racer from emacs shell, i got following message:

racer can't find the directory pointed to by the RUST_SRC_PATH variable "/cygdrive/c/src/rust/tasks/src/C:\Program Files\Rust stable 1.5\rustc-1.5.0\src". Try using an absolute fully qualified path and make sure it points to the src directory of a rust checkout - e.g. "/home/foouser/src/rust/src".

But i don't know how to fix this. By the way, i'm working in Cygwin.

Now, i got following error:

eldoc error: (error /cygdrive/d/Soft/Cygwin64/home/racer/target/release/racer exited with status 1)
1

I think you need to install rust source code and set the RUST_SRC_PATH environment variable. It's the point 4 in "Install from sources" in the racer readme https://github.com/phildawes/racer.

  • Already done, but it still does not works. – DoSofRedRiver Jan 24 '16 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.