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

RustLsp expandMacro fails to work in standalone file #90

Closed
fjchen7 opened this issue Dec 6, 2023 · 3 comments
Closed

RustLsp expandMacro fails to work in standalone file #90

fjchen7 opened this issue Dec 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@fjchen7
Copy link

fjchen7 commented Dec 6, 2023

Neovim version (nvim -v)

v0.9.4

Operating system/version

macOS

Output of :checkhealth rustaceanvim

==============================================================================
rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 0.3.1756-standalone (e402c494b 2023-12-01)
- OK Cargo: found cargo 1.74.0 (ecb9851af 2023-10-18)
- OK rustc: found rustc 1.74.0 (79e9716c9 2023-11-13)
- WARNING       debug adapter: not found.
  Install [lldb](https://lldb.llvm.org/) for extended capabilities.
  A debug adapter (defaults to: LLDB).
  Required for debugging features.

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

fn main() {
    println!("Hello, world!");
}

Run RustLsp expandMacro on macro println!

Expected behaviour

Expand macro

Actual behaviour

image

The minimal config used to reproduce this issue.

N/A
@fjchen7 fjchen7 added the bug Something isn't working label Dec 6, 2023
@mrcjkb
Copy link
Owner

mrcjkb commented Dec 6, 2023

Hey 👋

Thanks for reporting.
I may need some more context to reproduce this, as I cannot reproduce it locally, in a project or in a standalone file. Based on the error message in your screenshot, I assume you're calling it in a standalone file?
It looks unrelated to the expandMacro command.
But it's a bug nonetheless. I'll implement a fix for it and we'll see if it helps 😄

@mrcjkb
Copy link
Owner

mrcjkb commented Dec 6, 2023

I've implemented a fix for the error message in #91.

But if you're using a non-project file, I don't think expandMacro will work, because afaik, rust-analyzer needs a cargo project to do so.

@mrcjkb mrcjkb changed the title RustLsp expandMacro fails to work RustLsp expandMacro fails to work in standalone file Dec 6, 2023
@fjchen7
Copy link
Author

fjchen7 commented Dec 7, 2023

I found the cause. The issue occurs when cwd is outside of git repo directory. Thanks @mrcjkb

@fjchen7 fjchen7 closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants