aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/highlighting.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-15 09:00:11 +0000
committerGitHub <[email protected]>2019-12-15 09:00:11 +0000
commit3e8f9eb6c45b6bde294c79deea0e5bb02c084ae0 (patch)
tree91e2b4c2738c89f22209bdb5925f0ba50f02349c /editors/code/src/highlighting.ts
parentd6223253b628b279f9ddae8f83f7173d01f6b32c (diff)
parentfeb5a4a8b8b0a30d71cf34c7927bd41cbae4e104 (diff)
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 <[email protected]>
Diffstat (limited to 'editors/code/src/highlighting.ts')
-rw-r--r--editors/code/src/highlighting.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index 6d50a2f2d..d7c0ae131 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -53,10 +53,17 @@ export class Highlighter {
53 decoration('parameter'), 53 decoration('parameter'),
54 decoration('constant'), 54 decoration('constant'),
55 decoration('type'), 55 decoration('type'),
56 decoration('type.self'),
57 decoration('type.generic'),
58 decoration('type.param'),
59 decoration('type.lifetime'),
56 decoration('builtin'), 60 decoration('builtin'),
57 decoration('text'), 61 decoration('text'),
58 decoration('attribute'), 62 decoration('attribute'),
59 decoration('literal'), 63 decoration('literal'),
64 decoration('literal.numeric'),
65 decoration('literal.char'),
66 decoration('literal.byte'),
60 decoration('macro'), 67 decoration('macro'),
61 decoration('variable'), 68 decoration('variable'),
62 decoration('variable.mut', 'underline'), 69 decoration('variable.mut', 'underline'),