rust/crates
bors[bot] 3e8f9eb6c4
Merge #2559
2559: Add some granularity to syntax highlighting. r=matklad a=omerbenamram

Hi,

I wanted to start using `rust-analyzer` a bit more frequently - one of the main blockers for me so far was the highlighting.

I just discovered it's possible to override the default colors with `ralsp.<something>` setting without waiting for #2061!

However, the current implementation was lumping a bunch of different tokens into `type` and `literal`.
The golden standard IMO is what Clion is currently doing (and is my current daily driver for rust).

Clion allows users to control the coloring for specific literal kinds, and the default is to distinguish between them (numerics get a different color from strings, and special colors for bytestrings).

I've also splitted the builtin types, which are also allowed to be highlighted speratly.
My goal is to match the default experience I'm getting with clion.
The only blockers now I think is that `rust-analyzer` doesn't corrently infer types in some situations, so the highlighting information is incorrect in those cases.

This is what it looks like so far (with colors overriden to match clion's theme):
![image](https://user-images.githubusercontent.com/2467993/70848219-ccd97900-1e76-11ea-89e1-2e467cfcc9fb.png)

If there are any other changes you feel is necessary let me know.

I did leave the default colors to match the current behavior, since I'm not familiar with the colors for this theme, I added some random (different) colors in the test to check that it indeed was working.



Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-15 09:00:11 +00:00
..
ra_arena Switch to variant-granularity field type inference 2019-11-25 00:12:36 +03:00
ra_assists Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
ra_batch Support setting cargo features 2019-12-13 18:16:34 +08:00
ra_cfg Disable doctests 2019-11-17 18:35:05 +03:00
ra_cli Remove ty from code_model 2019-12-08 12:44:14 +01:00
ra_db Run rustfmt with respect to Cargo.toml edition 2019-12-04 23:05:01 +01:00
ra_fmt fix 2190; add test for "replace if let with match" 2019-11-20 19:01:06 +01:00
ra_hir Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
ra_hir_def Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
ra_hir_expand Rename N! to name! 2019-12-13 22:33:38 +01:00
ra_hir_ty Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
ra_ide Merge #2559 2019-12-15 09:00:11 +00:00
ra_lsp_server Merge #2548 2019-12-14 11:57:49 +00:00
ra_mbe Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
ra_parser Fix hir for ast::UnionDef 2019-11-25 17:50:49 +03:00
ra_prof Disable doctests 2019-11-17 18:35:05 +03:00
ra_project_model Use all-features by default 2019-12-14 17:05:12 +01:00
ra_syntax Avoid recompiling serde 2019-12-12 14:11:06 +01:00
ra_text_edit Disable doctests 2019-11-17 18:35:05 +03:00
ra_tt Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
ra_vfs_glob Disable doctests 2019-11-17 18:35:05 +03:00
test_utils Skip slow tests by default 2019-12-07 13:19:42 +01:00