Skip to main content

Style

Enum Style 

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

Source§

impl Style

Source

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§

Source§

impl Clone for Style

Source§

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

impl Copy for Style

Source§

impl Debug for Style

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Style

Source§

impl PartialEq for Style

Source§

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

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

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

§

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

Checks if this value is equivalent to the given key. Read more
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
§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> ResetDiscriminant<T> for T
where T: Copy,

§

fn discriminant(&self) -> T

Value based on which equality for the reset will be determined.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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