Is there a way to make rust.analyzer to use type aliases

I have started using rust-analyzer recently which does a great job showing the inferred types but there are times when I would rather see an alias for the type

For example; I am using nalgebra-glm which defines an alias for Vec2,

pub type Vec2 = TVec2<f32>;

which itself uses several levels of aliasing to finally declare it as a Matrix

When I create a Vec2 rust-analyzer expands the full type to

which is hard to parse when reading the code. Is there some way to change this behavior so it would display Vec2 instead of Matrix<.....>

It looks like this is not possible yet. There is an open feature request here:

1 Like

You can configure rust-analyzer.inlayHints.maxLength to at least have the hints be shortened, though.

1 Like

Thanks for the link. It does a good job of highlighting the complications around the feature