Skip to main content

Style

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 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

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 Clone for Style

§

fn clone(&self) -> Style

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for Style

§

impl Debug for Style

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Eq for Style

§

impl PartialEq for Style

§

fn eq(&self, other: &Style) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more