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

#[tokio:test] causes weird intellisense on the last line of the test #5882

Closed
escritorio-gustavo opened this issue Jul 19, 2023 · 3 comments
Closed
Labels
A-tokio-macros Area: The tokio-macros crate C-bug Category: This is a bug.

Comments

@escritorio-gustavo
Copy link

Version
tokio v1.28.0
tokio-macros v2.1.0 (proc-macro)
tokio-util v0.7.8
tokio v1.28.0 ()
tokio v1.28.0 (
)
tokio v1.28.0 ()
tokio-native-tls v0.3.1
tokio v1.28.0 (
)
tokio v1.28.0 ()
tokio-native-tls v0.3.1 (
)
tokio v1.28.0 (*)

Platform
Windows 11 64-bit Build: 22621.1992

Description
Enter your issue details here.
One way to structure the description:

When using the #[tokio:test] macro, the last line of the test function gets the syntax highliting of a function call, hovering over it indicates a call to new_current_thread. This occurs with macro calls (such as assert!), method calls on objects, and basically any identifier at the start of the last line (even if the identifier doesnt exist)

I tried this code:

mod test {
    #[tokio:test]
    async fn my_test() {
        assert!(true);
    }
}

I expected to see this happen:
assert! is highlighted as a macro call, hovering over it shows docs about the assert macro

Instead, this happened:
assert! is highlighted as a function call:
image

Hovering over it shows new_current_thread docs:
image

This happens to any identifier even if it doesn't exist:
image

This does not happen to let bindings, literals or inside control flow blocks, such as if or match:
image
image

@escritorio-gustavo escritorio-gustavo added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Jul 19, 2023
@taiki-e
Copy link
Member

taiki-e commented Jul 19, 2023

Is this the same issue as #5518 (except for macro is #[tokio:test] not #[tokio:main])?

@Darksonn Darksonn added A-tokio-macros Area: The tokio-macros crate and removed A-tokio Area: The main tokio crate labels Jul 20, 2023
@escritorio-gustavo
Copy link
Author

Yes, it does seem to be the same problem affecting #[tokio:test]

@Darksonn
Copy link
Contributor

Darksonn commented Oct 1, 2023

I'm going to close this as a duplicate.

@Darksonn Darksonn closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-macros Area: The tokio-macros crate C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants