georgewfraser/vscode-tree-sitter

[Bug] [Rust] Inconsistent hightligting on paths

lnicola opened this issue · 7 comments

use std::time::Duration;
fn foo1(x: std::time::Duration) {}

image

Actually, this might be intended, I'm not sure.

This is intended---Duration is a type, the other path elements are not.

I was referring to the Duration in use std::time::Duration;.

I spent some time trying to colorize use declarations last night. It turns out it's very hard to correctly recognize types in use declarations. We could rely on naming conventions + a list of builtin types.

I tried to outline a "colorization philosophy" in https://github.com/georgewfraser/vscode-tree-sitter#fixing-colorization-of-an-existing-language. I definitely think it would be better if types in use declarations were colorized as types, because it would be more consistent.

Thanks :-). In the meanwhile, I'm trying to improve the syntax highlighting of https://github.com/rust-analyzer/rust-analyzer/, which in the long run should be more precise, because it has full semantic information.

👋 Nice work on this plugin @georgewfraser. In Atom, we use the naming convention for this problem. I believe we treat capitalized items in paths as types.

Thanks for the tip @maxbrunsfeld !