Enum Style
pub enum Style {
Show 48 variants
Default,
Comment,
LineComment,
String,
Keyword,
Type,
Number,
Function,
Constant,
Variable,
Operator,
Punctuation,
Attribute,
Heading1,
Heading2,
Heading3,
Heading4,
Heading5,
Heading6,
Bold,
Italic,
Link,
Url,
MarkupRaw,
Markup,
DiagnosticError,
DiagnosticWarning,
DiagnosticInfo,
DiagnosticHint,
DiffAdd,
DiffRemove,
MessagesTimestamp,
MessagesTrace,
MessagesDebug,
MessagesInfo,
MessagesWarn,
MessagesError,
MagitSha,
MagitBranchCurrent,
MagitRefDecoration,
MagitRebaseVerb,
MagitAuthor,
HelpKey,
HelpCommand,
HelpAction,
HelpLiteral,
InlayHint,
Element(ElementId),
}Expand description
Semantic style category emitted by the tree-sitter highlighter.
Variants§
Default
Comment
LineComment
String
Keyword
Type
Number
Function
Constant
Variable
Operator
Punctuation
Attribute
Heading1
# Heading — level 1.
Heading2
## Heading — level 2.
Heading3
### Heading — level 3.
Heading4
#### Heading — level 4.
Heading5
##### Heading — level 5.
Heading6
###### Heading — level 6.
Bold
**bold** / __bold__ text.
Italic
*italic* / _italic_ text.
Link
Link label / link text ([label]). Distinct from Style::Url so
the renderer can underline navigable labels without underlining the URL.
Url
Link destination ((url)) and autolinks.
MarkupRaw
Inline `code`, fenced code blocks without an info string, link
titles.
Markup
List markers, thematic breaks, blockquote markers, and other markup punctuation.
DiagnosticError
Error-severity diagnostic line.
DiagnosticWarning
Warning-severity diagnostic line.
DiagnosticInfo
Information-severity diagnostic line.
DiagnosticHint
Hint-severity diagnostic line.
DiffAdd
Added line content (+ lines) in a unified diff.
DiffRemove
Removed line content (- lines) in a unified diff.
MessagesTimestamp
A commit SHA (magit-log, magit-blame, magit-rebase’s todo).
MessagesTrace
MessagesDebug
MessagesInfo
MessagesWarn
MessagesError
MagitSha
MagitBranchCurrent
The checked-out branch in a branch list (magit-branch’s *
marker + name).
MagitRefDecoration
A ref-decoration list after a log SHA ((HEAD -> main, ...)).
MagitRebaseVerb
A rebase-todo verb (pick/reword/edit/squash/fixup/drop).
MagitAuthor
The author column in magit-blame output.
HelpKey
A key or chord you press (`gr`, `<C-c>g`, `]]`).
HelpCommand
An ex-command you type (`:magit-status`).
HelpAction
An action id (`action:magit-refresh`).
HelpLiteral
Any other inline literal — a path, a filename, a git argument.
InlayHint
Inline virtual text — an LSP inlay hint, or any other leading / trailing text a producer splices into a row without it being in the buffer.
DL.3a: inlay runs used to be painted with a hardcoded
Color::Named(DarkGray) in the cells worker, with the run’s
style discarded — while inlay.hint had been a registered theme
element the whole time. Giving inlays a real style variant is
what routes them through the theme like everything else, and it
is what lets a producer override the colour per inlay (the
listing icons use Style::Element).
Element(ElementId)
A span styled by a registered theme element, named directly.
Every variant above is a closed, editor-owned category, and that is right for concepts the editor itself understands. It cannot work for vocabularies that are open by nature — a per-language file-icon palette has ~50 entries and grows, and a WASM plugin can register a theme element by name but can never add a variant to a Rust enum. Without this, themed highlighting is reachable only by editing core, which makes it impossible for plugins by construction (paramount goal #2).
syntax_element_id returns the id unchanged, so this resolves
through exactly the same ResolvedTheme lookup as every builtin
category — a theme retunes it by name like any other element.
Carries [lattice_theme::ElementId] (a u32 newtype), so
Style stays Copy and its size is unchanged.
Implementations§
§impl Style
impl Style
pub fn fingerprint(self) -> u64
pub fn fingerprint(self) -> u64
A stable-within-this-process numeric fingerprint, for folding a style into a cache-version hash.
DL.1: this exists because Style stopped being field-less.
Consumers used to write style as u64, which the compiler
allowed only while every variant was a unit — so adding
Style::Element would have broken them silently in spirit
(loudly in practice, which is how this was found). Routing them
through a named method means the payload is included in the
fingerprint: two spans differing only in which registered
element they name must not collide, or a theme-element change
would leave a stale matrix on screen.
Trait Implementations§
impl Copy for Style
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more