emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.79k stars 885 forks source link

avoid 'user-error: Multiple compilation artifacts are not supported' when debug from lsp-lens for lsp-rust #3214

Open wsw0108 opened 2 years ago

wsw0108 commented 2 years ago

Thank you for the bug report

Bug description

lsp-rust report 'user-error: Multiple compilation artifacts are not supported' when debug from lsp-lens for lsp-rust.

Steps to reproduce

  1. clone https://github.com/wsw0108/lsp-rust-issue
  2. start emacs with lsp-start-plani.el
  3. enable lsp-lens-mode
  4. click lens 'Debug'
  5. errors shows

Expected behavior

Can launch cpptools for single test from lsp-lens-mode.

Which Language Server did you use?

rust-analyzer (lsp-rust.el)

OS

Windows

Error callstack

user-error: Multiple compilation artifacts are not supported

Anything else?

Below link shows how rust-analyzer for vscode do: https://github.com/rust-analyzer/rust-analyzer/blob/4c20d6879f7b23c532dee908031caab178bb79fa/editors/code/src/toolchain.ts#L24-L78

yyoncho commented 2 years ago

I tested with that project on my side and it works fine:

Here is the vscode equivalent of that error:

https://github.com/rust-analyzer/rust-analyzer/blob/4c20d6879f7b23c532dee908031caab178bb79fa/editors/code/src/toolchain.ts#L86

Are you able to test if that works fine with vscode?

yyoncho commented 2 years ago

You may also change the following line code:

(_ (user-error "Multiple compilation artifacts are not supported" ) )

to

(_ (user-error "Multiple compilation artifacts are not supported %s"  artifact-spec) )

so we can see what are the generated artifacts(TBO I have only ported the vscode code, I am not familiar with what are the semantics here).

wsw0108 commented 2 years ago
user-error: Multiple compilation artifacts are not supported (e:\GitHub\lsp-rust-issue\target\debug\lsp-rust-issue.exe e:\GitHub\lsp-rust-issue\target\debug\deps\int-5f123ff5199c1f24.exe)

should be has only int-xxx.exe.

wsw0108 commented 2 years ago

Are you able to test if that works fine with vscode?

Yes, works fine with vscode(rust-analyzer + codelldb).