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

fix invalid path by rust-analyzer causing panic #4

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

blorbb
Copy link
Contributor

@blorbb blorbb commented Jul 2, 2024

Issue: using the nightly import_style! macro runs fine with rustc but panics in rust-analyzer.

image

Even adding the following to .vscode/settings.json does not prevent the error message for some reason.

"rust-analyzer.procMacro.ignored": {
    "stylance": ["import_style"]
}

The panic comes from the source file being SourceFile { path: "", is_real: true } when run by rust-analyzer. I added a check to see if there is no parent, and simply expand to nothing. This prevents auto-complete, but rustc errors/warnings about non-existent/unused values still works.

@basro basro merged commit cc52977 into basro:main Jul 2, 2024
1 check failed
@basro
Copy link
Owner

basro commented Jul 2, 2024

Thank you for reporting and investigating this, it seems rust analyzer has changed it's behavior here, this used to work fine.

Your solution looks like a reasonable workaround, I'll see to release a new version asap.

@basro
Copy link
Owner

basro commented Jul 2, 2024

Your PR is included in the v0.5.1 release.
Thank you for your contribution.

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

Successfully merging this pull request may close these issues.

2 participants