Stream: t-compiler/rust-analyzer

Topic: possible incorrect syntax highlighting


Chetan Khilosiya (Mar 22 2021 at 15:53, on Zulip):

this is the case of highlighting variable name in function. When the variable name is same as function then the variable is highlighted as function with semantic token type function.
Example: in rust-analyzer highlight.rs file line number 33. element is name of function and variable also.

Chetan Khilosiya (Mar 22 2021 at 15:53, on Zulip):

Is this known or some special case I don't know?

Laurențiu (Mar 22 2021 at 16:03, on Zulip):

You can file an issue so we don't forget about it

Lukas Wirth (Mar 22 2021 at 16:04, on Zulip):

Thats known but we havent made an issue about it yet i think

Lukas Wirth (Mar 22 2021 at 16:05, on Zulip):

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Cross.20crate.20find.20usages.20seems.20to.20be.20broken.3F/near/229489409

Chetan Khilosiya (Mar 22 2021 at 16:09, on Zulip):

Laurențiu Nicola said:

You can file an issue so we don't forget about it

Sure I will file issue.

Chetan Khilosiya (Mar 22 2021 at 16:17, on Zulip):

Created issue: https://github.com/rust-analyzer/rust-analyzer/issues/8152

Chetan Khilosiya (Mar 22 2021 at 16:18, on Zulip):

I am trying to implement to apply trait modifier to function names and refs. How to know when function is trait function or not?

Chetan Khilosiya (Mar 22 2021 at 16:19, on Zulip):

I can't find anything related in semantics.

Lukas Wirth (Mar 22 2021 at 16:24, on Zulip):

You can use AsAssocItem to get the function/const/type alias as an associated item https://github.com/rust-analyzer/rust-analyzer/blob/94aa3a7b1af7b756139e6c2d8384beb57daa6190/crates/hir/src/lib.rs#L1176-L1179

Lukas Wirth (Mar 22 2021 at 16:25, on Zulip):

AssocItem then has a container method you can use to check where the assoc item comes from

Chetan Khilosiya (Mar 22 2021 at 16:25, on Zulip):

what is the meaning of assoc items in rust?

Laurențiu (Mar 22 2021 at 16:26, on Zulip):

https://doc.rust-lang.org/reference/items/associated-items.html

Lukas Wirth (Mar 22 2021 at 16:26, on Zulip):

Associated items are functions, type aliases and consts that are defined in an impl block/ trait

Chetan Khilosiya (Mar 22 2021 at 16:28, on Zulip):

this definition I have known. but I am not able to link how it is internally provide me details of function. I will study the implementation in RA.

Chetan Khilosiya (Mar 22 2021 at 16:28, on Zulip):

Thank you for the pointers. :)

Last update: Jul 28 2021 at 03:00UTC