Merge #8795
8795: Allow semantic tokens for strings to be disabled r=matklad a=djrenren Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7111 Pretty straightforward change, but open to any suggestions if there's a more recommended testing strategy than what I went with. Co-authored-by: John Renner <john@jrenner.net>
This commit is contained in:
@@ -381,6 +381,7 @@ pub(crate) fn semantic_tokens(
|
||||
text: &str,
|
||||
line_index: &LineIndex,
|
||||
highlights: Vec<HlRange>,
|
||||
include_strings: bool,
|
||||
) -> lsp_types::SemanticTokens {
|
||||
let id = TOKEN_RESULT_COUNTER.fetch_add(1, Ordering::SeqCst).to_string();
|
||||
let mut builder = semantic_tokens::SemanticTokensBuilder::new(id);
|
||||
@@ -389,8 +390,11 @@ pub(crate) fn semantic_tokens(
|
||||
if highlight_range.highlight.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let (type_, mods) = semantic_token_type_and_modifiers(highlight_range.highlight);
|
||||
let token_index = semantic_tokens::type_index(type_);
|
||||
let (typ, mods) = semantic_token_type_and_modifiers(highlight_range.highlight);
|
||||
if !include_strings && typ == lsp_types::SemanticTokenType::STRING {
|
||||
continue;
|
||||
}
|
||||
let token_index = semantic_tokens::type_index(typ);
|
||||
let modifier_bitset = mods.0;
|
||||
|
||||
for mut text_range in line_index.index.lines(highlight_range.range) {
|
||||
|
||||
Reference in New Issue
Block a user