aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-27 10:56:06 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-27 10:56:06 +0100
commit0d1c6076073c73f57340e256dc25da9d37311ef0 (patch)
tree60ff1f4a42f8ef297c07d5716af67e3057c8e1bd /crates/ra_lsp_server/src
parent4b48cff022a1606bde596f01fbf44361640b10d8 (diff)
parent1e6ba1901550fb1610a1a464c48ec358cd3c339c (diff)
Merge #1319
1319: Rainbow highlighting spike 🌈 r=killercup a=killercup Very simple approach: For each identifier, set the hash of the range where it's defined as its 'id' and use it in the VSCode extension to generate unique colors. Thus, the generated colors are per-file. They are also quite fragile, and I'm not entirely sure why. Looks like we need to make sure the same ranges aren't overwritten by a later request? Co-authored-by: Pascal Hertleif <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs6
-rw-r--r--crates/ra_lsp_server/src/req.rs1
2 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index a82ae696b..e36db12b3 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -872,7 +872,11 @@ fn highlight(world: &ServerWorld, file_id: FileId) -> Result<Vec<Decoration>> {
872 .analysis() 872 .analysis()
873 .highlight(file_id)? 873 .highlight(file_id)?
874 .into_iter() 874 .into_iter()
875 .map(|h| Decoration { range: h.range.conv_with(&line_index), tag: h.tag }) 875 .map(|h| Decoration {
876 range: h.range.conv_with(&line_index),
877 tag: h.tag,
878 binding_hash: h.binding_hash.map(|x| x.to_string()),
879 })
876 .collect(); 880 .collect();
877 Ok(res) 881 Ok(res)
878} 882}
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 6090eb7b9..992c24eac 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -129,6 +129,7 @@ pub struct PublishDecorationsParams {
129pub struct Decoration { 129pub struct Decoration {
130 pub range: Range, 130 pub range: Range,
131 pub tag: &'static str, 131 pub tag: &'static str,
132 pub binding_hash: Option<String>,
132} 133}
133 134
134pub enum ParentModule {} 135pub enum ParentModule {}