1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

LanguageServers/Cpp: Add SemanticType::PreprocessorMacro

This adds a new semantic token type, PreprocessorMacro.

Calls to preprocessor macros will now be highlighted when semantic
highlighting is enabled in Hack Studio.
This commit is contained in:
Itamar 2022-03-31 19:09:29 +03:00 committed by Andreas Kling
parent 597ca68e2d
commit 9cd27d1e15
4 changed files with 18 additions and 5 deletions

View file

@ -100,6 +100,8 @@ static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, GUI::
return { palette.syntax_member(), false };
case GUI::AutocompleteProvider::TokenInfo::SemanticType::Parameter:
return { palette.syntax_parameter(), false };
case GUI::AutocompleteProvider::TokenInfo::SemanticType::PreprocessorMacro:
return { palette.syntax_preprocessor_value(), false };
default:
VERIFY_NOT_REACHED();
return { palette.base_text(), false };
@ -152,7 +154,8 @@ bool SemanticSyntaxHighlighter::is_identifier(u64 token_type) const
|| type == AutocompleteProvider::TokenInfo::SemanticType::CustomType
|| type == AutocompleteProvider::TokenInfo::SemanticType::Namespace
|| type == AutocompleteProvider::TokenInfo::SemanticType::Member
|| type == AutocompleteProvider::TokenInfo::SemanticType::Parameter;
|| type == AutocompleteProvider::TokenInfo::SemanticType::Parameter
|| type == AutocompleteProvider::TokenInfo::SemanticType::PreprocessorMacro;
}
bool SemanticSyntaxHighlighter::is_navigatable(u64 token_type) const