diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-08 12:55:27 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-08 12:55:27 +0100 |
commit | 06a8deae4a29949f438d66c54eed4e016ac35432 (patch) | |
tree | 695c569cd28f84ca2dd1b75a8d4b3e71f1dabe09 /crates/ra_ide_api/src | |
parent | 92cf0eba93b8d2705ed39bef1a4ea665ed3c25dc (diff) | |
parent | 6503add6e3c900ea7ded37199ea58f43bb57b051 (diff) |
Merge #1969
1969: restore coloring of attributes r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_api/src/snapshots/highlighting.html | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/syntax_highlighting.rs | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 24f1b91f6..2d92fe1c5 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -325,7 +325,8 @@ impl Analysis { | |||
325 | let file_id = FileId(0); | 325 | let file_id = FileId(0); |
326 | // FIXME: cfg options | 326 | // FIXME: cfg options |
327 | // Default to enable test for single file. | 327 | // Default to enable test for single file. |
328 | let cfg_options = CfgOptions::default().atom("test".into()); | 328 | let mut cfg_options = CfgOptions::default(); |
329 | cfg_options.insert_atom("test".into()); | ||
329 | crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options); | 330 | crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options); |
330 | change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text)); | 331 | change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text)); |
331 | change.set_crate_graph(crate_graph); | 332 | change.set_crate_graph(crate_graph); |
diff --git a/crates/ra_ide_api/src/snapshots/highlighting.html b/crates/ra_ide_api/src/snapshots/highlighting.html index ae30ebba3..b39c4d371 100644 --- a/crates/ra_ide_api/src/snapshots/highlighting.html +++ b/crates/ra_ide_api/src/snapshots/highlighting.html | |||
@@ -19,7 +19,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
19 | .keyword\.unsafe { color: #DFAF8F; } | 19 | .keyword\.unsafe { color: #DFAF8F; } |
20 | .keyword\.control { color: #F0DFAF; font-weight: bold; } | 20 | .keyword\.control { color: #F0DFAF; font-weight: bold; } |
21 | </style> | 21 | </style> |
22 | <pre><code><span class="attribute">#</span><span class="attribute">[</span><span class="attribute text">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span> | 22 | <pre><code><span class="attribute">#</span><span class="attribute">[</span><span class="attribute">derive</span><span class="attribute">(</span><span class="attribute">Clone</span><span class="attribute">,</span><span class="attribute"> </span><span class="attribute">Debug</span><span class="attribute">)</span><span class="attribute">]</span> |
23 | <span class="keyword">struct</span> <span class="type">Foo</span> { | 23 | <span class="keyword">struct</span> <span class="type">Foo</span> { |
24 | <span class="keyword">pub</span> <span class="field">x</span>: <span class="type">i32</span>, | 24 | <span class="keyword">pub</span> <span class="field">x</span>: <span class="type">i32</span>, |
25 | <span class="keyword">pub</span> <span class="field">y</span>: <span class="type">i32</span>, | 25 | <span class="keyword">pub</span> <span class="field">y</span>: <span class="type">i32</span>, |
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 9ae2dc061..1d290387c 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -97,6 +97,9 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
97 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string", | 97 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string", |
98 | ATTR => "attribute", | 98 | ATTR => "attribute", |
99 | NAME_REF => { | 99 | NAME_REF => { |
100 | if node.ancestors().any(|it| it.kind() == ATTR) { | ||
101 | continue; | ||
102 | } | ||
100 | if let Some(name_ref) = node.as_node().cloned().and_then(ast::NameRef::cast) { | 103 | if let Some(name_ref) = node.as_node().cloned().and_then(ast::NameRef::cast) { |
101 | // FIXME: try to reuse the SourceAnalyzers | 104 | // FIXME: try to reuse the SourceAnalyzers |
102 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); | 105 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); |