Skip to content

IDE feature support for asm macro #11621

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

Open
Veykril opened this issue Mar 4, 2022 · 5 comments
Open

IDE feature support for asm macro #11621

Veykril opened this issue Mar 4, 2022 · 5 comments
Labels
A-ide general IDE features C-feature Category: feature request E-unknown It's unclear if the issue is E-hard or E-easy without digging in fun A technically challenging issue with high impact S-actionable Someone could pick this issue up and work on it right now

Comments

@Veykril
Copy link
Member

Veykril commented Mar 4, 2022

We should be able to support asm macro calls with more features like name resolution for locals passed to it, completions, semantic highlighting etc

cc #6031

@Veykril Veykril added fun A technically challenging issue with high impact E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-actionable Someone could pick this issue up and work on it right now C-feature Category: feature request A-ide general IDE features labels Mar 4, 2022
@fs-99
Copy link

fs-99 commented Mar 1, 2024

I would love to see all the sym usage sites in the references view for a function.

Imagine a kernel function getting called from assembly called kernel_init. The references view for kernel_init should lead me to the asm block sym where I use it.
Where would I have to start to implement this without implementing everything else too? 😄

edited

@Veykril
Copy link
Member Author

Veykril commented Mar 1, 2024

Could you elaborate on the project you are referring to? 😅

Also someone might be picking this up as a GSoC project: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/GSoC.20Proposal.20for.20Rust.20Analyzer

@fs-99
Copy link

fs-99 commented Mar 1, 2024

Updated my comment, and I agree GSoC is the right place for this :)
They should feel free to do it, sounds fun.

@Veykril
Copy link
Member Author

Veykril commented May 22, 2024

Quoting myself from zulip:

Alright, basically the asm macro (like the format_args one) expands to a special placeholder syntax internally (builtin#asm(template_string0, template_string1, ..., fmt_arg0, fmt_arg1, ...)). The template strings behave like the format_arg! one mostly, so a lot of similar stuff can be done there, and if all you want for now is get completions in the templates working you can probably copy a lot from it there.

The first thing that needs to be done is adjust the ungram grammar file and parser to parse that correctly, then lowering needs to be done, and finally you can add the completion stuff and whatever other IDE features you'd like:

An aside, test fixtures in the IDE layer, like those in the completions crate do not have access to the standard library, the special first line //- minicore: fmt gives your test fixture a stripped down core library, https://github.com/rust-lang/rust-analyzer/blob/760ad445e2037868ef40dd3cddb4e1f66bdc7e71/crates/test-utils/src/minicore.rs the comment at the top explains that

@Veykril
Copy link
Member Author

Veykril commented Jul 7, 2024

The GSoC doesn't seem to happen so this is up for grabs given my previous instructions fwiw

bors added a commit that referenced this issue Sep 5, 2024
feat: IDE support for `asm!` expressions

Fixes #10461, Fixes #6031 Progresses #11621

Notably this only works for asm expressions not items yet. Most IDE features work, mainly completions need extra logic still.
lnicola pushed a commit to lnicola/rust that referenced this issue Sep 25, 2024
feat: IDE support for `asm!` expressions

Fixes rust-lang/rust-analyzer#10461, Fixes rust-lang/rust-analyzer#6031 Progresses rust-lang/rust-analyzer#11621

Notably this only works for asm expressions not items yet. Most IDE features work, mainly completions need extra logic still.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ide general IDE features C-feature Category: feature request E-unknown It's unclear if the issue is E-hard or E-easy without digging in fun A technically challenging issue with high impact S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

2 participants