Rust-analyzer: Does not work for attribute proc macros

Created on 18 Sep 2020  路  23Comments  路  Source: rust-analyzer/rust-analyzer

rust-analyzer does not work for this file:

use serenity::{
    client::*,
    framework::standard::{macros::command, Args, CommandResult},
    model::channel::Message,
};

#[command]
fn clear(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult {
    Ok(())
}

No intellisense, no completion, nothing works. I assume it's because of command macro?

A-macro S-unactionable

All 23 comments

Yes, attribute proc macros are not supported.

I can't edit the issue title, can you rename it to something like the above?

CC #5412, #2984.

Most features should still work as if the attribute wasn't there though.

@dakyskye can you confirm that completions are not working?

image

@lnicola yes image

Is that Vim? How did you configure rust-analyzer?

@lnicola it is NeoVim, yes, with coc.nvim extension. That's the only rust-analyser config I have "rust-analyzer.serverPath": "rust-analyzer"

Can you run it (from the same terminal) with rust-analyzer --version? If you installed from source, it should be under ~/.cargo/bin, and I'd expect that to be in PATH, but it doesn't hurt to check.

Weird enough! My output for it is rust-analyzer ???????. I installed it from the Arch packages.

pacman -Q --info rust-analyzer outputs Version: 20200914-1

Can you try https://github.com/fannheyward/coc-rust-analyzer/ instead? I think the official extension doesn't work too well with coc.nvim.

I use coc-rust-analyzer, but with custom rust-analyzer path.

I have also tried it in VSCode though, the same negative result.

Does it work for you (in Code) with a new project?

Nope
image

Sorry, I meant a new project as cargo new produces.

Yes, I did that.

Can't reproduce, maybe this is fixed in master?

image

It's weird. I have just tried it in VSCode, Vim and Emacs, works nowhere.
VSC result:
image

Ah, you said "master". I have latest release installed, let me build RA myself and try again.

EDIT: built rust-analyzer, but the result is same.

@dakyskye if you run Rust Analyzer: Status command, does it list anything as file deps?

image

I accidentally deleted vscode package, and just reinstalled it. Now rust-analyzer works well for me in VSC. Let me try it in Emacs now
image

It started working in VSCode, but still not working in Vim and Emacs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suhr picture suhr  路  33Comments

matklad picture matklad  路  25Comments

Veetaha picture Veetaha  路  27Comments

aochagavia picture aochagavia  路  41Comments

yaahc picture yaahc  路  27Comments