Merge #4940
4940: Add support for marking doctest items as distinct from normal code r=ltentrup a=Nashenas88 This adds `HighlightTag::Generic | HighlightModifier::Injected` as the default highlight for all elements within a doctest. Please feel free to suggest that a new tag be created or a different one used.  Fixes #4929 Fixes #4939 Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com> Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
This commit is contained in:
@@ -39,13 +39,14 @@ define_semantic_token_types![
|
||||
(BOOLEAN, "boolean"),
|
||||
(BUILTIN_TYPE, "builtinType"),
|
||||
(ENUM_MEMBER, "enumMember"),
|
||||
(ESCAPE_SEQUENCE, "escapeSequence"),
|
||||
(FORMAT_SPECIFIER, "formatSpecifier"),
|
||||
(GENERIC, "generic"),
|
||||
(LIFETIME, "lifetime"),
|
||||
(SELF_KEYWORD, "selfKeyword"),
|
||||
(TYPE_ALIAS, "typeAlias"),
|
||||
(UNION, "union"),
|
||||
(UNRESOLVED_REFERENCE, "unresolvedReference"),
|
||||
(FORMAT_SPECIFIER, "formatSpecifier"),
|
||||
(ESCAPE_SEQUENCE, "escapeSequence"),
|
||||
];
|
||||
|
||||
macro_rules! define_semantic_token_modifiers {
|
||||
@@ -68,6 +69,7 @@ macro_rules! define_semantic_token_modifiers {
|
||||
define_semantic_token_modifiers![
|
||||
(CONSTANT, "constant"),
|
||||
(CONTROL_FLOW, "controlFlow"),
|
||||
(INJECTED, "injected"),
|
||||
(MUTABLE, "mutable"),
|
||||
(UNSAFE, "unsafe"),
|
||||
(ATTRIBUTE_MODIFIER, "attribute"),
|
||||
|
||||
@@ -295,6 +295,7 @@ fn semantic_token_type_and_modifiers(
|
||||
HighlightTag::SelfType => lsp_types::SemanticTokenType::TYPE,
|
||||
HighlightTag::Field => lsp_types::SemanticTokenType::PROPERTY,
|
||||
HighlightTag::Function => lsp_types::SemanticTokenType::FUNCTION,
|
||||
HighlightTag::Generic => semantic_tokens::GENERIC,
|
||||
HighlightTag::Module => lsp_types::SemanticTokenType::NAMESPACE,
|
||||
HighlightTag::Constant => {
|
||||
mods |= semantic_tokens::CONSTANT;
|
||||
@@ -331,6 +332,7 @@ fn semantic_token_type_and_modifiers(
|
||||
HighlightModifier::Attribute => semantic_tokens::ATTRIBUTE_MODIFIER,
|
||||
HighlightModifier::Definition => lsp_types::SemanticTokenModifier::DECLARATION,
|
||||
HighlightModifier::Documentation => lsp_types::SemanticTokenModifier::DOCUMENTATION,
|
||||
HighlightModifier::Injected => semantic_tokens::INJECTED,
|
||||
HighlightModifier::ControlFlow => semantic_tokens::CONTROL_FLOW,
|
||||
HighlightModifier::Mutable => semantic_tokens::MUTABLE,
|
||||
HighlightModifier::Unsafe => semantic_tokens::UNSAFE,
|
||||
|
||||
Reference in New Issue
Block a user