allan2 / dotenvy

A well-maintained fork of the dotenv crate
MIT License
708 stars 45 forks source link

rust-analyzer: Unresolved macro call for dotenv! #1

Closed allan2 closed 1 year ago

allan2 commented 2 years ago

This is the same issue as rust-analyzer #9606.

When using rust-analyzer with dotenv!, this mesage appears:

unresolved macro `dotenv!`rust-analyzerunresolved-macro-call

Example repo: https://github.com/allan2/dotenv-macro

src/main.rs:

use dotenvy_codegen::dotenv;

fn main() {
    println!("{}", dotenv!("MSG"));
}

The issue appears to be related to proc-macro-hack according to this comment.

kdwarn commented 1 year ago

Is this still an issue with newer versions of rust-analyzer? I'm not getting that message in either Neovim or Helix, with rust-analyzer 1.65.

sonro commented 1 year ago

I haven't seen this myself. Either way, proc_macro_hack can be removed: see #43.