pub struct Config {
pub version: u64,
pub languages: Vec<String>,
pub imports: Vec<String>,
pub rules: Vec<Rule>,
pub scopes: Vec<Scope>,
/* private fields */
}Expand description
A validated configuration: the schema version, global rules, and scopes.
Fields§
§version: u64The config’s declared schema version (always
SUPPORTED_VERSION).
languages: Vec<String>The editor language ids this config applies to (exact match
against the client’s languageId; in Neovim, the filetype).
Empty = every language.
imports: Vec<String>The raw import: entries, as written.
rules: Vec<Rule>The validated global rules, in file order (imported rules first).
scopes: Vec<Scope>The validated scopes, in file order (imported scopes first).
Implementations§
Source§impl Config
impl Config
Sourcepub fn matches_language(&self, id: &str) -> bool
pub fn matches_language(&self, id: &str) -> bool
Whether this config applies to documents with language id id.
Configs without a languages key apply to everything.
Source§impl Config
impl Config
Sourcepub fn from_str(yaml: &str) -> Result<Self, ConfigError>
pub fn from_str(yaml: &str) -> Result<Self, ConfigError>
Loads and validates a config from YAML text.
preset: imports resolve against the embedded library; relative
file imports need a file — use Config::load for those.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more