mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Add the rust-analyzer.semanticHighlighting.comments.enable configuration value
This commit is contained in:
parent
21614ed2d3
commit
d106d41fbc
9 changed files with 157 additions and 19 deletions
|
|
@ -35,6 +35,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub(crate) use html::highlight_as_html;
|
||||
pub(crate) use html::highlight_as_html_with_config;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct HlRange {
|
||||
|
|
@ -47,6 +48,8 @@ pub struct HlRange {
|
|||
pub struct HighlightConfig {
|
||||
/// Whether to highlight strings
|
||||
pub strings: bool,
|
||||
/// Whether to highlight comments
|
||||
pub comments: bool,
|
||||
/// Whether to highlight punctuation
|
||||
pub punctuation: bool,
|
||||
/// Whether to specialize punctuation highlights
|
||||
|
|
@ -588,6 +591,7 @@ fn descend_token(
|
|||
fn filter_by_config(highlight: &mut Highlight, config: HighlightConfig) -> bool {
|
||||
match &mut highlight.tag {
|
||||
HlTag::StringLiteral if !config.strings => return false,
|
||||
HlTag::Comment if !config.comments => return false,
|
||||
// If punctuation is disabled, make the macro bang part of the macro call again.
|
||||
tag @ HlTag::Punctuation(HlPunct::MacroBang) => {
|
||||
if !config.macro_bang {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue