Skip to content
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

Rust LSP (rust-analyzer) fails to start properly for any crate not in the ~ folder #14894

Open
Chronal opened this issue Jul 5, 2021 · 39 comments

Comments

@Chronal
Copy link
Contributor

Chronal commented Jul 5, 2021

Description :octocat:

Trying to use the rust lsp-mode with rust-analyzer doesn't work.

Reproduction guide 🪲

  • Start Emacs
  • Open up eshell
  • cd a directory outside of ~, Eg: cd ~/Documents
  • Create a new crate: cargo new test-crate
  • Open the src/main.rs file in the test-crate directory
  • Notice that flycheck-rust-setup failed and the lsp isn't working properly inside the folder

Observed behaviour: 👀 💔

  • Mini-buffer shows the error: LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error)
  • Auto-complete doesn't work properly
  • As a note, LSP sets the up the ~ folder by default: LSP :: rust-analyzer:1150323 initialized successfully in folders: (/home/chronal)

Expected behaviour: ❤️ 😄

  • No error and rust auto-completion to function correctly. For example, when defining structs, types should be suggested.

System Info 💻

  • OS: gnu/linux
  • Emacs: 27.2
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. be74dd7)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(html auto-completion asm
      (c-c++ :variables c-c++-backend 'lsp-clangd c-c++-dap-adapters
             '(dap-cpptools dap-gdb-lldb)
             c-c++-enable-clang-format-on-save t)
      common-lisp
      (clojure :variables clojure-enable-fancify-symbols t)
      (dap :variables lsp-lens-enable t)
      elixir erlang emacs-lisp
      (git :variables git-enable-magit-delta-plugin t git-enable-magit-gitflow-plugin t)
      go helm
      (latex :variables latex-refresh-preview t)
      (lsp :variables lsp-rust-server 'rust-analyzer cargo-process-reload-on-modify t lsp-lens-enable t)
      markdown multiple-cursors
      (org :variables org-enable-roam-support t org-enable-roam-server t org-enable-roam-protocol t)
      (rust :variables rust-backend 'lsp)
      pdf python
      (shell :variables shell-default-shell 'eshell shell-default-height 30 shell-default-position 'bottom)
      spell-checking syntax-checking
      (treemacs :variables treemacs-lock-width t treemacs-git-mode 'deferred))
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Backtrace 🐾

Debugger entered--Lisp error: (wrong-type-argument listp #<hash-table equal 7/65 0x156da8e26c51>)
  flycheck-rust-get-cargo-targets("/home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml")
  flycheck-rust-find-cargo-target("/home/chronal/Projects/Programming/personal/simple-lisp/src/main.rs")
  flycheck-rust-setup()
  run-hooks(flycheck-mode-hook flycheck-mode-on-hook)
  flycheck-mode(1)
  lsp-diagnostics-flycheck-enable()
  lsp-diagnostics-mode(1)
  lsp-diagnostics--enable()
  #f(compiled-function () #<bytecode 0x156da82973c1>)()
  run-hooks(lsp-configure-hook)
  lsp-configure-buffer()
  lsp-managed-mode(1)
  lsp--text-document-did-open()
  lsp--open-in-workspace(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 24/24 0x156da81d2fd5> :registered-server-capabilities nil :root "/home/chronal" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x156da90eda15>) :test\? #f(compiled-function () #<bytecode 0x156da90eda21>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x156da9513b3d> :request-handlers #<hash-table equal 0/65 0x156da89f30b9> :response-handlers #<hash-table eql 2/65 0x156daa746df9> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x156da9774d0d> :action-handlers #<hash-table equal 3/65 0x156da93ff379> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x156daa544b85>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn #f(compiled-function () #<bytecode 0x156da93094b1>) :async-request-handlers #<hash-table equal 0/65 0x156da7fc7e3d> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x156da93094bd>) :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rust-analyzer> :cmd-proc #<process rust-analyzer> :buffers (#<buffer main.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x156daa071e51> :watches #<hash-table equal 0/65 0x156daa071e71> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x156da8ed5cb5> :work-done-tokens #<hash-table equal 0/65 0x156da8ed60b5>))
  #f(compiled-function (buffer) #<bytecode 0x156da9ff2ed1>)(#<buffer main.rs>)
  mapc(#f(compiled-function (buffer) #<bytecode 0x156da9ff2ed1>) (#<buffer main.rs>))
  #f(compiled-function (response) #<bytecode 0x156da8ea1905>)(#<hash-table equal 2/2 0x156da81d2f81>)
  #f(compiled-function (result) #<bytecode 0x156da8e827cd>)(#<hash-table equal 2/2 0x156da81d2f81>)
  #f(compiled-function (result) #<bytecode 0x156da8e827e9>)(#<hash-table equal 2/2 0x156da81d2f81>)
  lsp--parser-on-message(#<hash-table equal 3/3 0x156da81d2f29> #s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 24/24 0x156da81d2fd5> :registered-server-capabilities nil :root "/home/chronal" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x156da90eda15>) :test\? #f(compiled-function () #<bytecode 0x156da90eda21>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x156da9513b3d> :request-handlers #<hash-table equal 0/65 0x156da89f30b9> :response-handlers #<hash-table eql 2/65 0x156daa746df9> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x156da9774d0d> :action-handlers #<hash-table equal 3/65 0x156da93ff379> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x156daa544b85>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn #f(compiled-function () #<bytecode 0x156da93094b1>) :async-request-handlers #<hash-table equal 0/65 0x156da7fc7e3d> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x156da93094bd>) :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rust-analyzer> :cmd-proc #<process rust-analyzer> :buffers (#<buffer main.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x156daa071e51> :watches #<hash-table equal 0/65 0x156daa071e71> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x156da8ed5cb5> :work-done-tokens #<hash-table equal 0/65 0x156da8ed60b5>))
  #f(compiled-function (msg) #<bytecode 0x156da9ff2e41>)(#<hash-table equal 3/3 0x156da81d2f29>)
  mapc(#f(compiled-function (msg) #<bytecode 0x156da9ff2e41>) (#<hash-table equal 3/3 0x156da81d2f29>))
  #f(compiled-function (proc input) #<bytecode 0x156da8ed60e5>)(#<process rust-analyzer> "Content-Length: 2277\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":26,\"...")
@smile13241324
Copy link
Collaborator

This sounds like an issue with the LSP server, can you post the content of the lsp-log? I would like to know what the server complains about.

@Chronal
Copy link
Contributor Author

Chronal commented Jul 15, 2021

It seems that the LSP server is starting up fine.

Command "rls" is present on the path.
Command "/usr/bin/rust-analyzer" is present on the path.
Command "rls" is present on the path.
Command "/usr/bin/rust-analyzer" is present on the path.
Found the following clients for /home/chronal/Projects/Programming/personal/simple-lisp/src/lib.rs: (server-id rls, priority -1), (server-id rust-analyzer, priority 1)
The following clients were selected based on priority: (server-id rust-analyzer, priority 1)

@lebensterben
Copy link
Collaborator

@Chronal
Make sure your home directory itself is not in ~/.emacs.d/.lsp-session-v1. Otherwise when a file under some sub directory of home directory is opened, LSP may think home directory is the root of the workspace. Then it will fail to find a valid project config file (Cargo.toml for Rust).

@Chronal
Copy link
Contributor Author

Chronal commented Jul 25, 2021

Okay, there is some progress!

I deleted the .lsp-session-v1 file and then restarted Spacemacs. Autocomplete is now working in my rust projects. 😄 Thanks!

There are still some error messages however:

LSP :: Connected to [rust-analyzer:101038/starting].
Error in flycheck-rust-setup: (wrong-type-argument listp #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("packages" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "lispcalc" "version" "0.1.0" "id" "lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)" "license" nil "license_file" nil "description" nil "source" nil "dependencies" nil "targets" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("lib") "crate_types" ("lib") "name" "compiler" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/lib.rs" "edition" "2018" "doc" t "doctest" t "test" t)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("bin") "crate_types" ("bin") "name" "repl" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/main.rs" "edition" "2018" "doc" t "doctest" :json-false "test" t))) "features" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) "manifest_path" "/home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml" "metadata" nil "publish" nil "authors" ("Anuj Dhavalikar <[email protected]>") "categories" nil "keywords" nil "readme" "README.md" "repository" nil "homepage" nil "documentation" nil "edition" "2018" "links" nil "default_run" nil))) "workspace_members" ("lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)") "resolve" nil "target_directory" "/home/chronal/Projects/Programming/personal/simple-lisp/target" "version" 1 "workspace_root" "/home/chronal/Projects/Programming/personal/simple-lisp" "metadata" nil)))
LSP :: rust-analyzer:101038 initialized successfully in folders: (/home/chronal/Projects/Programming/personal/simple-lisp)
LSP :: Error from the Language Server: content modified (Unknown error) [2 times]

A very similar error message pops up when opening up each rust project.

@lebensterben
Copy link
Collaborator

I've never seen this. Can you retry after updating rust analyzer and emacs packages, specifically flycheck and rust related ones?

@Chronal
Copy link
Contributor Author

Chronal commented Jul 25, 2021

I updated all my packages:

  • I'm running rustc 1.56.0 nightly on commit d9aa28767.
  • I'm running arch and have installed rust-analyzer-git through the aur. The version is2fe586a8a781f22f4e5a82037ed459fe28e87f8f commit on master, which was commited yesterday.
  • I have run SPC-f-e-U to update all my packages and then restarted with SPC-q-R to restart emacs

I am still getting the error messages when opening a rust project, however:

LSP :: Connected to [rust-analyzer:11196/starting].
Error in flycheck-rust-setup: (wrong-type-argument listp #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("packages" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "lispcalc" "version" "0.1.0" "id" "lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)" "license" nil "license_file" nil "description" nil "source" nil "dependencies" nil "targets" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("lib") "crate_types" ("lib") "name" "compiler" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/lib.rs" "edition" "2018" "doc" t "doctest" t "test" t)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("bin") "crate_types" ("bin") "name" "repl" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/main.rs" "edition" "2018" "doc" t "doctest" :json-false "test" t))) "features" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) "manifest_path" "/home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml" "metadata" nil "publish" nil "authors" ("Anuj Dhavalikar <[email protected]>") "categories" nil "keywords" nil "readme" "README.md" "repository" nil "homepage" nil "documentation" nil "edition" "2018" "links" nil "default_run" nil))) "workspace_members" ("lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)") "resolve" nil "target_directory" "/home/chronal/Projects/Programming/personal/simple-lisp/target" "version" 1 "workspace_root" "/home/chronal/Projects/Programming/personal/simple-lisp" "metadata" nil)))
LSP :: rust-analyzer:11196 initialized successfully in folders: (/home/chronal/Projects/Programming/personal/simple-lisp)
LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error) [4 times]
LSP :: Error from the Language Server: content modified (Unknown error) [2 times]

The lsp server is being properly initializing the project folders and autocomplete is working in those projects despite the errors.

@lebensterben
Copy link
Collaborator

waiting for cargo metadata or cargo check

Does cargo check runs properly?

@Chronal
Copy link
Contributor Author

Chronal commented Jul 26, 2021

Yes, it does.

-*- mode: cargo-process; default-directory: "~/Projects/Programming/personal/simple-lisp/" -*-
Cargo-Process started at Mon Jul 26 22:53:06

/usr/bin/cargo check --manifest-path /home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml 
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

Cargo-Process finished at Mon Jul 26 22:53:06

@lebensterben
Copy link
Collaborator

Does the issue persist?

@Chronal
Copy link
Contributor Author

Chronal commented Aug 24, 2021

I still get an error message, but the LSP initialises correctly in the right folder. Autocomplete and commands triggered using the leader key (",") seem to work as expected.

LSP :: Connected to [rust-analyzer:21570/starting].
Error in flycheck-rust-setup: (wrong-type-argument listp #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("packages" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("name" "lispcalc" "version" "0.1.0" "id" "lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)" "license" nil "license_file" nil "description" nil "source" nil "dependencies" nil "targets" (#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("lib") "crate_types" ("lib") "name" "compiler" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/lib.rs" "edition" "2018" "doc" t "doctest" t "test" t)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("kind" ("bin") "crate_types" ("bin") "name" "repl" "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/main.rs" "edition" "2018" "doc" t "doctest" :json-false "test" t))) "features" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) "manifest_path" "/home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml" "metadata" nil "publish" nil "authors" ("Anuj Dhavalikar <[email protected]>") "categories" nil "keywords" nil "readme" "README.md" "repository" nil "homepage" nil "documentation" nil "edition" "2018" "links" nil "default_run" nil))) "workspace_members" ("lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)") "resolve" nil "target_directory" "/home/chronal/Projects/Programming/personal/simple-lisp/target" "version" 1 "workspace_root" "/home/chronal/Projects/Programming/personal/simple-lisp" "metadata" nil)))
LSP :: rust-analyzer:21570 initialized successfully in folders: (/home/chronal/Projects/Programming/personal/simple-lisp)
LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error) [4 times]

@lebensterben
Copy link
Collaborator

@Chronal
Things just sounds confusing to me.

If LSP doesn't start properly it may show DISCONNET in the modeline. You can also try "SPC m b" to see whether there are key bindings for LSP client related functions. If it's working there should be 4.

What do you see?

@Chronal
Copy link
Contributor Author

Chronal commented Aug 26, 2021

Yeah, it's a strange issue. The flycheck-rust-setup function seems to be throwing an error but despite that the LSP initialises properly.

I don't see DISCONNECT in the modeline and SPC-m-b shows 5 options:

  • lsp-describe-session
  • lsp-workspace-restart
  • lsp-workspace-shutdown
  • lsp-version
  • lsp-rust-analyzer-reload-workspace

@lebensterben
Copy link
Collaborator

so aside from the error message, is everything appears okay?

@Chronal
Copy link
Contributor Author

Chronal commented Aug 26, 2021

I think so, yeah.

@lebensterben
Copy link
Collaborator

@Chronal
can you post your .lsp-session-v1?

@Chronal
Copy link
Contributor Author

Chronal commented Aug 28, 2021

This is my .lsp-session-v1

#s(lsp-session ("/home/chronal/Projects/Programming/learning/haskell/CIS194_spring13/w1" "/home/chronal/Projects/Programming/uni/COMP3520/student_material/tut1/q4" "/home/chronal/Projects/Programming/uni/COMP3520/teaching_material/pi-os" "/home/chronal/Projects/Programming/personal/simple-lisp") nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()))

@lebensterben
Copy link
Collaborator

Your .lsp-session-v1 looks fine.


As for the error (reformatted for readability):

;; Error in flycheck-rust-setup:
(wrong-type-argument
 listp
 #s(hash-table
    size 65
    test equal
    rehash-size 1.5
    rehash-threshold 0.8125
    data ("packages" (#s(hash-table
                         size 65
                         test equal
                         rehash-size 1.5
                         rehash-threshold 0.8125
                         data ("name" "lispcalc"
                               "version" "0.1.0"
                               "id" "lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)"
                               "license" nil
                               "license_file" nil
                               "description" nil
                               "source" nil
                               "dependencies" nil
                               "targets" (#s(hash-table
                                             size 65
                                             test equal
                                             rehash-size 1.5
                                             rehash-threshold 0.8125
                                             data ("kind" ("lib")
                                                   "crate_types" ("lib")
                                                   "name" "compiler"
                                                   "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/lib.rs"
                                                   "edition" "2018"
                                                   "doc" t
                                                   "doctest" t
                                                   "test" t))
                                            #s(hash-table
                                               size 65
                                               test equal
                                               rehash-size 1.5
                                               rehash-threshold 0.8125
                                               data ("kind" ("bin")
                                                     "crate_types" ("bin")
                                                     "name" "repl"
                                                     "src_path" "/home/chronal/Projects/Programming/personal/simple-lisp/src/main.rs"
                                                     "edition" "2018"
                                                     "doc" t
                                                     "doctest" :json-false
                                                     "test" t)))
                               "features" #s(hash-table
                                             size 65
                                             test equal
                                             rehash-size 1.5
                                             rehash-threshold 0.8125
                                             data ())
                               "manifest_path" "/home/chronal/Projects/Programming/personal/simple-lisp/Cargo.toml"
                               "metadata" nil
                               "publish" nil
                               "authors" ("Anuj Dhavalikar <[email protected]>")
                               "categories" nil
                               "keywords" nil
                               "readme" "README.md"
                               "repository" nil
                               "homepage" nil
                               "documentation" nil
                               "edition" "2018"
                               "links" nil
                               "default_run" nil)))
          "workspace_members" ("lispcalc 0.1.0 (path+file:///home/chronal/Projects/Programming/personal/simple-lisp)")
          "resolve" nil
          "target_directory" "/home/chronal/Projects/Programming/personal/simple-lisp/target"
          "version" 1
          "workspace_root" "/home/chronal/Projects/Programming/personal/simple-lisp"
          "metadata" nil)))

this error is straightforward, it expects a list, but gets a hash table. the hash table itself looks valid, and you can see it's basically what you get with cargo metadata.

@lebensterben
Copy link
Collaborator

just to verify your flycheck-rust is up to data.
If you go to ~/.emacs.d/elpa/27.2/develop, there should be a directory named as flycheck-rust-VERSION. VERSION should be 20190319.1546.

@lebensterben
Copy link
Collaborator

Also, please enable debug, retry, and paste the error.
(setq debug-on-error t)

@Chronal
Copy link
Contributor Author

Chronal commented Sep 16, 2021

I'm sorry for the delayed response.

The VERSION is 20190319.1546, so flycheck-rust is up to date.

When opening a rust file with after running (setq debug-on-error t), this is what the debugger prints out when it enters:

Debugger entered--Lisp error: (wrong-type-argument listp #<hash-table equal 7/65 0x158afa5bf049>)
  flycheck-rust-get-cargo-targets("/home/chronal/Projects/simple-lisp/Cargo.toml")
  flycheck-rust-find-cargo-target("/home/chronal/Projects/simple-lisp/src/lib.rs")
  flycheck-rust-setup()
  run-hooks(flycheck-mode-hook flycheck-mode-on-hook)
  flycheck-mode(1)
  lsp-diagnostics-flycheck-enable()
  lsp-diagnostics-mode(1)
  lsp-diagnostics--enable()
  (progn (lsp-diagnostics--enable))
  (if lsp-auto-configure (progn (lsp-diagnostics--enable)))
  (lambda nil (if lsp-auto-configure (progn (lsp-diagnostics--enable))))()
  run-hooks(lsp-configure-hook)
  lsp-configure-buffer()
  lsp-managed-mode(1)
  lsp--text-document-did-open()
  lsp--open-in-workspace(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 24/24 0x158af88afdb1> :registered-server-capabilities nil :root "/home/chronal/Projects/simple-lisp" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x158af859cb49>) :test\? #f(compiled-function () #<bytecode 0x158af85986c1>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x158af8596f7d> :request-handlers #<hash-table equal 0/65 0x158af85a4965> :response-handlers #<hash-table eql 1/65 0x158af85a4985> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x158af85a8471> :action-handlers #<hash-table equal 3/65 0x158af85a43d9> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x158af859cb25>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn #f(compiled-function () #<bytecode 0x158af859cb31>) :async-request-handlers #<hash-table equal 0/65 0x158af85a8491> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x158af859cb3d>) :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rust-analyzer> :cmd-proc #<process rust-analyzer> :buffers (#<buffer lib.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x158af85736c1> :watches #<hash-table equal 0/65 0x158af88b33bd> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x158af7cb16b1> :work-done-tokens #<hash-table equal 0/65 0x158af8e2fc91>))
  #f(compiled-function (buffer) #<bytecode 0x158af8d8268d>)(#<buffer lib.rs>)
  mapc(#f(compiled-function (buffer) #<bytecode 0x158af8d8268d>) (#<buffer lib.rs>))
  #f(compiled-function (response) #<bytecode 0x158af7b9b221>)(#<hash-table equal 2/2 0x158af88afd5d>)
  #f(compiled-function (result) #<bytecode 0x158af985fb25>)(#<hash-table equal 2/2 0x158af88afd5d>)
  #f(compiled-function (result) #<bytecode 0x158af985fb39>)(#<hash-table equal 2/2 0x158af88afd5d>)
  lsp--parser-on-message(#<hash-table equal 3/3 0x158af88afd05> #s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 24/24 0x158af88afdb1> :registered-server-capabilities nil :root "/home/chronal/Projects/simple-lisp" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x158af859cb49>) :test\? #f(compiled-function () #<bytecode 0x158af85986c1>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x158af8596f7d> :request-handlers #<hash-table equal 0/65 0x158af85a4965> :response-handlers #<hash-table eql 1/65 0x158af85a4985> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x158af85a8471> :action-handlers #<hash-table equal 3/65 0x158af85a43d9> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x158af859cb25>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn #f(compiled-function () #<bytecode 0x158af859cb31>) :async-request-handlers #<hash-table equal 0/65 0x158af85a8491> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x158af859cb3d>) :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rust-analyzer> :cmd-proc #<process rust-analyzer> :buffers (#<buffer lib.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x158af85736c1> :watches #<hash-table equal 0/65 0x158af88b33bd> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x158af7cb16b1> :work-done-tokens #<hash-table equal 0/65 0x158af8e2fc91>))
  #f(compiled-function (msg) #<bytecode 0x158af8d82609>)(#<hash-table equal 3/3 0x158af88afd05>)
  mapc(#f(compiled-function (msg) #<bytecode 0x158af8d82609>) (#<hash-table equal 3/3 0x158af88afd05>))
  #f(compiled-function (proc input) #<bytecode 0x158af911a4e1>)(#<process rust-analyzer> "Content-Length: 2348\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":1,\"r...")

This is the error as displayed in messages

Error in flycheck-rust-setup:
(wrong-type-argument
 listp
 #s(hash-table
    size 65
    test equal
    rehash-size 1.5
    rehash-threshold 0.8125
    data ("packages" (#s(hash-table
                         size 65
                         test equal
                         rehash-size 1.5
                         rehash-threshold 0.8125
                         data ("name" "lispcalc"
                               "version" "0.1.0"
                               "id" "lispcalc 0.1.0 (path+file:///home/chronal/Projects/simple-lisp)"
                               "license" nil "license_file" nil
                               "description" nil
                               "source" nil
                               "dependencies" nil
                               "targets" (#s(hash-table
                                             size 65
                                             test equal
                                             rehash-size 1.5
                                             rehash-threshold 0.8125
                                             data ("kind" ("lib")
                                                   "crate_types" ("lib")
                                                   "name" "compiler"
                                                   "src_path" "/home/chronal/Projects/simple-lisp/src/lib.rs"
                                                   "edition" "2018"
                                                   "doc" t
                                                   "doctest" t
                                                   "test" t))
                                            #s(hash-table size 65
                                                          test equal
                                                          rehash-size 1.5
                                                          rehash-threshold 0.8125
                                                          data ("kind" ("bin")
                                                                "crate_types" ("bin")
                                                                "name" "repl"
                                                                "src_path" "/home/chronal/Projects/simple-lisp/src/main.rs"
                                                                "edition" "2018"
                                                                "doc" t
                                                                "doctest" :json-false
                                                                "test" t)))
                               "features" #s(hash-table
                                             size 65
                                             test equal
                                             rehash-size 1.5
                                             rehash-threshold 0.8125
                                             data ())
                               "manifest_path" "/home/chronal/Projects/simple-lisp/Cargo.toml"
                               "metadata" nil
                               "publish" nil
                               "authors" ("Anuj <[email protected]>")
                               "categories" nil
                               "keywords" nil
                               "readme" "README.md"
                               "repository" nil
                               "homepage" nil
                               "documentation" nil
                               "edition" "2018"
                               "links" nil
                               "default_run" nil)))
          "workspace_members" ("lispcalc 0.1.0 (path+file:///home/chronal/Projects/simple-lisp)")
          "resolve" nil
          "target_directory" "/home/chronal/Projects/simple-lisp/target"
          "version" 1
          "workspace_root" "/home/chronal/Projects/simple-lisp"
          "metadata" nil))) [5 times]

@lebensterben
Copy link
Collaborator

@Chronal
I git cloned your project https://github.com/Chronal/simple-lisp-interpreter to /tmp and has no issue with lsp-rust.

for reference, I manually evaluated the last two calls before the error:

ELISP> (flycheck-rust-find-cargo-target "/tmp/simple-lisp-interpreter/src/lib.rs")
((kind . "lib")
 (name . "compiler"))

ELISP> (flycheck-rust-get-cargo-targets "/tmp/simple-lisp-interpreter/Cargo.toml")
((((kind "lib")
   (crate_types "lib")
   (name . "compiler")
   (src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
   (edition . "2018")
   (doc . t)
   (doctest . t)
   (test . t))
  ((kind "bin")
   (crate_types "bin")
   (name . "repl")
   (src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
   (edition . "2018")
   (doc . t)
   (doctest . :json-false)
   (test . t))))

Can you do the same (git clone the repo to /tmp and manually run those functions) and paste the output?

@visigoth
Copy link

visigoth commented Sep 18, 2021

fwiw i am running into the same error running cargo 1.54.0 (5ae8d74b3 2021-06-22) and rustc 1.54.0 (a178d0322 2021-07-26). i started a brand new project with cargo new something and then opened src/main.rs in spacemacs. i ran into the same error - a list is expected where a hash table was provided

also, i checked my version of flycheck-rust and it is correct: ~/.emacs.d/elpa/develop/flycheck-rust-20190319.1546

@lebensterben
Copy link
Collaborator

@visigoth
See #14894 (comment)

@Chronal
Copy link
Contributor Author

Chronal commented Sep 18, 2021

This is the output of those elisp functions when run in the /tmp/simple-lisp-interpreter.

ELISP> (flycheck-rust-find-cargo-target "/tmp/simple-lisp-interpreter/src/lib.rs")
((kind . "lib")
 (name . "compiler"))

ELISP> (flycheck-rust-get-cargo-targets "/tmp/simple-lisp-interpreter/Cargo.toml")
((((kind "lib")
   (crate_types "lib")
   (name . "compiler")
   (src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
   (edition . "2018")
   (doc . t)
   (doctest . t)
   (test . t))
  ((kind "bin")
   (crate_types "bin")
   (name . "repl")
   (src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
   (edition . "2018")
   (doc . t)
   (doctest . :json-false)
   (test . t))))

When trying to open /tmp/simple-lisp-interpreter/main.rs, there is prompt saying that the file is not part of any project and it asks for a directory so the project can be imported. After selecting the directory, the error caused by flycheck-rust-setup seen in #14894 (comment) occurs. The error is followed by the following messages:

LSP :: rust-analyzer:11183 initialized successfully in folders: (/tmp/simple-lisp-interpreter)
LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error) [3 times]
LSP :: Error from the Language Server: content modified (Unknown error) [2 times]

@lebensterben
Copy link
Collaborator

@Chronal
The outputs are exactly the same.

The following is the part of backtrace relevant here:

Debugger entered--Lisp error: (wrong-type-argument listp #<hash-table equal 7/65 0x158afa5bf049>)
  flycheck-rust-get-cargo-targets("/home/chronal/Projects/simple-lisp/Cargo.toml")
  flycheck-rust-find-cargo-target("/home/chronal/Projects/simple-lisp/src/lib.rs")
  flycheck-rust-setup()

When a Rust buffer is opened, flycheck-rust-setup is evaluated.

It calls flycheck-rust-find-cargo-target at https://github.com/flycheck/flycheck-rust/blob/a139cd53c5062697e9ed94ad80b803c37d999600/flycheck-rust.el#L201 to set the cargo build target of the current file. This step is correct since we have same output when we manually run it.

During flycheck-rust-find-cargo-target, it first needs to find out all cargo build target of a manifest file, so it calls flycheck-rust-get-cargo-targets at https://github.com/flycheck/flycheck-rust/blob/a139cd53c5062697e9ed94ad80b803c37d999600/flycheck-rust.el#L132. This also runs correctly when it's called manually.

But flycheck-rust-get-cargo-targets doesn't return as it encounters the wrong-type-argument error.


What's the output of

(let-alist
  (with-temp-buffer
    (call-process cargo nil '(t nil) nil
                  "metadata" "--no-deps"
                  "--manifest-path" "/tmp/simple-lisp-interpreter/Cargo.toml"
                  "--format-version" "1")
    (goto-char (point-min))
    (let ((json-array-type 'list))
          (json-read)))
  .packages)

it should be

(((name . "lispcalc")
  (version . "0.1.0")
  (id . "lispcalc 0.1.0 (path+file:///tmp/simple-lisp-interpreter)")
  (license)
  (license_file)
  (description)
  (source)
  (dependencies)
  (targets
   ((kind "lib")
    (crate_types "lib")
    (name . "compiler")
    (src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
    (edition . "2018")
    (doc . t)
    (doctest . t)
    (test . t))
   ((kind "bin")
    (crate_types "bin")
    (name . "repl")
    (src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
    (edition . "2018")
    (doc . t)
    (doctest . :json-false)
    (test . t)))
  (features)
  (manifest_path . "/tmp/simple-lisp-interpreter/Cargo.toml")
  (metadata)
  (publish)
  (authors "Anuj Dhavalikar <[email protected]>")
  (categories)
  (keywords)
  (readme . "README.md")
  (repository)
  (homepage)
  (documentation)
  (edition . "2018")
  (links)
  (default_run)))

If this runs correctly without error, please evaluate

(let ((cargo (funcall flycheck-executable-find "cargo")))
  (let-alist
      (with-temp-buffer
        (call-process cargo nil '(t nil) nil
                      "metadata" "--no-deps"
                      "--manifest-path" "/tmp/simple-lisp-interpreter/Cargo.toml"
                      "--format-version" "1")
        (goto-char (point-min))
        (let ((json-array-type 'list))
          (json-read)))
    (seq-map (lambda (pkg) (let-alist pkg .targets)) .packages)))

and the output should be

((((kind "lib")
   (crate_types "lib")
   (name . "compiler")
   (src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
   (edition . "2018")
   (doc . t)
   (doctest . t)
   (test . t))
  ((kind "bin")
   (crate_types "bin")
   (name . "repl")
   (src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
   (edition . "2018")
   (doc . t)
   (doctest . :json-false)
   (test . t))))

@wyuenho

This comment has been minimized.

@svenpanne
Copy link

Just as another data point: I get the same error message as the OP from a "Hello, world!"-like project, too. Regarding the output requested on 23 Sep above, I get:

(((name . "hello") (version . "0.1.0") (id . "hello 0.1.0 (path+file:///home/sp/programming_rust/hello)") (license) (license_file) (description) (source) (dependencies) (targets ((kind "bin") (crate_types "bin") (name . "hello") (src_path . "/home/sp/programming_rust/hello/src/main.rs") (edition . "2018") (doc . t) (doctest . :json-false) (test . t))) (features) (manifest_path . "/home/sp/programming_rust/hello/Cargo.toml") (metadata) (publish) (authors) (categories) (keywords) (readme) (repository) (homepage) (documentation) (edition . "2018") (links) (default_run)))

and

((((kind "bin") (crate_types "bin") (name . "hello") (src_path . "/home/sp/programming_rust/hello/src/main.rs") (edition . "2018") (doc . t) (doctest . :json-false) (test . t))))

@Chronal
Copy link
Contributor Author

Chronal commented Nov 29, 2021

Apologies again for the lack of timely communication on my part.

I ran the first command, with a slight modification. Instead of cargo, I put "cargo" as I was getting an *** Eval error *** Symbol’s value as variable is void: cargo.

Running the first command, I get the following

(((name . "lispcalc")
  (version . "0.1.0")
  (id . "lispcalc 0.1.0 (path+file:///tmp/simple-lisp-interpreter)")
  (license)
  (license_file)
  (description)
  (source)
  (dependencies)
  (targets
   ((kind "lib")
	(crate_types "lib")
	(name . "compiler")
	(src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
	(edition . "2018")
	(doc . t)
	(doctest . t)
	(test . t))
   ((kind "bin")
	(crate_types "bin")
	(name . "repl")
	(src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
	(edition . "2018")
	(doc . t)
	(doctest . :json-false)
	(test . t)))
  (features)
  (manifest_path . "/tmp/simple-lisp-interpreter/Cargo.toml")
  (metadata)
  (publish)
  (authors "Anuj Dhavalikar <[email protected]>")
  (categories)
  (keywords)
  (readme . "README.md")
  (repository)
  (homepage)
  (documentation)
  (edition . "2018")
  (links)
  (default_run)
  (rust_version)))

This matches the expected output almost exactly. The only difference I can see is (rust-version) at the end, which I doubt is significant.

The next command outputs this

((((kind "lib")
   (crate_types "lib")
   (name . "compiler")
   (src_path . "/tmp/simple-lisp-interpreter/src/lib.rs")
   (edition . "2018")
   (doc . t)
   (doctest . t)
   (test . t))
  ((kind "bin")
   (crate_types "bin")
   (name . "repl")
   (src_path . "/tmp/simple-lisp-interpreter/src/main.rs")
   (edition . "2018")
   (doc . t)
   (doctest . :json-false)
   (test . t))))

which matches the expected output exactly.

@Chronal
Copy link
Contributor Author

Chronal commented Nov 30, 2021

I spent some time today getting familiar with elisp so that I could try debug the issue. Here's what I've got so far.

After the line 107 in flycheck-rust.el, I checked the value of json-object-type, and it was hash-table instead of alist as is the default. This is what causes the wrong type error as it causes (json-read) to convert the json into a hash-table. This can be fixed by changing the let block on line 108 from

(let ((json-array-type 'list))
  (json-read)))

to

(let ((json-array-type 'list)
      (json-object-type 'alist))
  (json-read))) 

This fix works, but it it is odd that json-object-type is hash-table in the scope of flycheck-rust-get-cargo-targets. I haven't changed the default value of json-object-type (alist). All the instancesjson-object-type being bound to hash-table I could find were doing so using a let block. Do let block propagate their bindings to functions higher up the call stack in elisp? I saw that lsp code sets json-object-type to hash-table in a let block and that code eventually calls flycheck-rust-get-cargo-targets, so that may be an explanation.

The above only takes care of the wrong-type-argument error. There are still some LSP related errors/warnings remaining. They don't seem to affect the function of the LSP however.

After restarting spacemacs and opening a .rs file, this is the contents of the *lsp-log* buffer

Command "rls" is present on the path.
Command "/usr/bin/rust-analyzer" is present on the path.
Command "rls" is present on the path.
Command "/usr/bin/rust-analyzer" is present on the path.
Found the following clients for /tmp/simple-lisp-interpreter/src/main.rs: (server-id rls, priority -1), (server-id rust-analyzer, priority 1)
The following clients were selected based on priority: (server-id rust-analyzer, priority 1)
Creating watchers for following 2 folders:
  /tmp/simple-lisp-interpreter
  /tmp/simple-lisp-interpreter/src

and this is the contents of the *Messages* buffer

LSP :: Connected to [rust-analyzer:468754/starting].
LSP :: rust-analyzer:468754 initialized successfully in folders: (/tmp/simple-lisp-interpreter)
LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error) [3 times]
LSP :: Error from the Language Server: content modified (Unknown error) [2 times]

Finally, I've noticed some issues with Cargo-Process. Running cargo build for example , c c results in a successful compile, however the output does not properly handle control sequences (for colour), so the output is unreadable

-*- mode: cargo-process; default-directory: "/tmp/simple-lisp-interpreter/" -*-
Cargo-Process started at Tue Nov 30 14:35:53

/usr/bin/cargo build --manifest-path /tmp/simple-lisp-interpreter/Cargo.toml 
�[0m�[1m�[33mwarning�[0m�[0m�[1m: unnecessary parentheses around `if` condition�[0m
�[0m  �[0m�[0m�[1m�[38;5;12m--> �[0m�[0msrc/parser.rs:12:8�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m|�[0m
�[0m�[1m�[38;5;12m12�[0m�[0m �[0m�[0m�[1m�[38;5;12m| �[0m�[0m    if (len > 2) {�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m| �[0m�[0m       �[0m�[0m�[1m�[33m^�[0m�[0m       �[0m�[0m�[1m�[33m^�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m|�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m= �[0m�[0m�[1mnote�[0m�[0m: `#[warn(unused_parens)]` on by default�[0m
�[0m�[1m�[38;5;14mhelp�[0m�[0m: remove these parentheses�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m|�[0m
�[0m�[1m�[38;5;12m12�[0m�[0m �[0m�[0m�[38;5;9m- �[0m�[0m    if �[0m�[0m�[38;5;9m(�[0m�[0mlen > 2�[0m�[0m�[38;5;9m)�[0m�[0m {�[0m
�[0m�[1m�[38;5;12m12�[0m�[0m �[0m�[0m�[38;5;10m+ �[0m�[0m    if len > 2 {�[0m
�[0m   �[0m�[0m�[1m�[38;5;12m| �[0m

-- SNIP --

Should I create a separate issue for this?

@wildstyl3r
Copy link

Hello! I use Emacs and recently faced problem with

Error in flycheck-rust-setup: (wrong-type-argument listp...

I just started configuring Emacs for Rust, don't know much about ecosystem for now.
My setup uses rustic, with no rust-mode. For me that problem disappeared after I set for flycheck-rust init

(with-eval-after-load 'rustic-mode
  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))

Although "LSP :: Error from the Language Server: waiting for cargo metadata or cargo check (Unknown error)" persists.
And company's auto completion works strange for functions

@lebensterben
Copy link
Collaborator

@Chronal

It looks like everything is working properly on cargo's side as we always see the same result from cargo's metadata.

The only problem is the wrong type of argument error and I've no idea what caused it.


The issue with control sequence is likely fixed in a recent commit. Please retry.

@rinconjc
Copy link
Contributor

rinconjc commented Jan 8, 2022

I have the same issue with 'flycheck-rust-setup failing.
@Chronal suggested fix works. I think the json-object-type should be explicitly bound to alist, given that it could have been bound to something else from a different context, e.g. lsp-mode.

@lebensterben
Copy link
Collaborator

thanks for reporting.
I'll make a PR for upstream tomorrow.

@Chronal
Copy link
Contributor Author

Chronal commented Jan 9, 2022

@lebensterben

The issue with control sequence is likely fixed in a recent commit. Please retry.

I have retried after updating, however the control sequences issue persists. I have found a fix here: kwrooijen/cargo.el#45. By setting the cargo-process--command-flags to --color=never the control sequences issue goes away and, surprisingly, keeps the output of cargo coloured. This is only the case if you use cargo through cargo-process (SPC-m-c-*). The issue persists after this fix if cargo is run through the clickable buttons that show up near the main function when using rust-analyzer, though I suspect that is because lsp-mode for rust does not use cargo-process.


I'm glad that fix seems to be working for others. Thanks for making a pull request to push it upstream. 😄

@lebensterben
Copy link
Collaborator

@Chronal
Please pull in the latest develop branch updates.
I've just tried both cargo-process-test and cargo-process-build and they both works with ANSI colors.

@Chronal
Copy link
Contributor Author

Chronal commented Jun 3, 2022

Hey,

I've run git pull --rebase inside the .emacs.d directory while having checked out the develop branch and run SPC-f-e-U but I'm still having issues with red colors when running cargo-process commands.

@Visne
Copy link

Visne commented Jul 6, 2022

I think flycheck-rust is practically dead, hence why flycheck/flycheck-rust#82 is still not merged after almost a year.

Is there a valid reason to be using flycheck-rust anyways now that flycheck supports Rust directly?

@Luctins
Copy link
Contributor

Luctins commented Sep 22, 2023

Bump.

I think flycheck-rust is practically dead, hence why flycheck/flycheck-rust#82 is still not merged after almost a year.

Is there a valid reason to be using flycheck-rust anyways now that flycheck supports Rust directly?

@lebensterben is there a way to use the standard flycheck?

I've been recently having intermittent issues with the rust layer and before that the issues cited on this thread.

@Ghasak
Copy link

Ghasak commented Feb 28, 2024

I have used this and it works
cargo install --git https://github.com/rust-lang/rust-analyzer.git --branch master --locked rust-analyzer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests