Add the rust-analyzer.semanticHighlighting.comments.enable configuration value

This commit is contained in:
Bart Jacobs 2025-09-17 15:46:23 +02:00
parent 21614ed2d3
commit d106d41fbc
9 changed files with 157 additions and 19 deletions

View file

@ -382,6 +382,13 @@ config_data! {
/// Exclude tests from find-all-references and call-hierarchy.
references_excludeTests: bool = false,
/// Use semantic tokens for comments.
///
/// In some editors (e.g. vscode) semantic tokens override other highlighting grammars.
/// By disabling semantic tokens for comments, other grammars can be used to highlight
/// their contents.
semanticHighlighting_comments_enable: bool = true,
/// Inject additional highlighting into doc comments.
///
/// When enabled, rust-analyzer will highlight rust source in doc comments as well as intra
@ -1968,6 +1975,7 @@ impl Config {
pub fn highlighting_config(&self) -> HighlightConfig {
HighlightConfig {
strings: self.semanticHighlighting_strings_enable().to_owned(),
comments: self.semanticHighlighting_comments_enable().to_owned(),
punctuation: self.semanticHighlighting_punctuation_enable().to_owned(),
specialize_punctuation: self
.semanticHighlighting_punctuation_specialization_enable()