diff options
author | John Renner <[email protected]> | 2021-05-10 21:34:09 +0100 |
---|---|---|
committer | John Renner <[email protected]> | 2021-05-10 21:34:09 +0100 |
commit | 7ae3967e5739b786fcd3f7b7b333c73f2c38e8dd (patch) | |
tree | da0ab8119d19bcce349eb9c60825761898a231e4 /crates/rust-analyzer/src/handlers.rs | |
parent | c3ba1f14faaf132de7c216123878a681d7f3ca61 (diff) |
Formatting and docs
Diffstat (limited to 'crates/rust-analyzer/src/handlers.rs')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 85dd73fca..78b558a21 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -1377,7 +1377,8 @@ pub(crate) fn handle_semantic_tokens_full( | |||
1377 | 1377 | ||
1378 | let highlights = snap.analysis.highlight(file_id)?; | 1378 | let highlights = snap.analysis.highlight(file_id)?; |
1379 | let semantic_strings = snap.config.semantic_strings(); | 1379 | let semantic_strings = snap.config.semantic_strings(); |
1380 | let semantic_tokens = to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | 1380 | let semantic_tokens = |
1381 | to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | ||
1381 | 1382 | ||
1382 | // Unconditionally cache the tokens | 1383 | // Unconditionally cache the tokens |
1383 | snap.semantic_tokens_cache.lock().insert(params.text_document.uri, semantic_tokens.clone()); | 1384 | snap.semantic_tokens_cache.lock().insert(params.text_document.uri, semantic_tokens.clone()); |
@@ -1397,7 +1398,8 @@ pub(crate) fn handle_semantic_tokens_full_delta( | |||
1397 | 1398 | ||
1398 | let highlights = snap.analysis.highlight(file_id)?; | 1399 | let highlights = snap.analysis.highlight(file_id)?; |
1399 | let semantic_strings = snap.config.semantic_strings(); | 1400 | let semantic_strings = snap.config.semantic_strings(); |
1400 | let semantic_tokens = to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | 1401 | let semantic_tokens = |
1402 | to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | ||
1401 | 1403 | ||
1402 | let mut cache = snap.semantic_tokens_cache.lock(); | 1404 | let mut cache = snap.semantic_tokens_cache.lock(); |
1403 | let cached_tokens = cache.entry(params.text_document.uri).or_default(); | 1405 | let cached_tokens = cache.entry(params.text_document.uri).or_default(); |
@@ -1427,7 +1429,8 @@ pub(crate) fn handle_semantic_tokens_range( | |||
1427 | 1429 | ||
1428 | let highlights = snap.analysis.highlight_range(frange)?; | 1430 | let highlights = snap.analysis.highlight_range(frange)?; |
1429 | let semantic_strings = snap.config.semantic_strings(); | 1431 | let semantic_strings = snap.config.semantic_strings(); |
1430 | let semantic_tokens = to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | 1432 | let semantic_tokens = |
1433 | to_proto::semantic_tokens(&text, &line_index, highlights, semantic_strings); | ||
1431 | Ok(Some(semantic_tokens.into())) | 1434 | Ok(Some(semantic_tokens.into())) |
1432 | } | 1435 | } |
1433 | 1436 | ||