parent
2a5565ca93
commit
4798161118
28 changed files with 893 additions and 937 deletions
|
@ -2,7 +2,7 @@ mod keymap_file;
|
|||
pub mod settings_file;
|
||||
pub mod watched_json;
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{bail, Result};
|
||||
use gpui::{
|
||||
font_cache::{FamilyId, FontCache},
|
||||
AssetSource,
|
||||
|
@ -14,6 +14,10 @@ use schemars::{
|
|||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use sqlez::{
|
||||
bindable::{Bind, Column},
|
||||
statement::Statement,
|
||||
};
|
||||
use std::{collections::HashMap, fmt::Write as _, num::NonZeroU32, str, sync::Arc};
|
||||
use theme::{Theme, ThemeRegistry};
|
||||
use tree_sitter::Query;
|
||||
|
@ -55,24 +59,6 @@ pub struct FeatureFlags {
|
|||
pub experimental_themes: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Default)]
|
||||
pub enum ReleaseChannel {
|
||||
#[default]
|
||||
Dev,
|
||||
Preview,
|
||||
Stable,
|
||||
}
|
||||
|
||||
impl ReleaseChannel {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
ReleaseChannel::Dev => "Zed Dev",
|
||||
ReleaseChannel::Preview => "Zed Preview",
|
||||
ReleaseChannel::Stable => "Zed",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FeatureFlags {
|
||||
pub fn keymap_files(&self) -> Vec<&'static str> {
|
||||
vec![]
|
||||
|
@ -244,6 +230,33 @@ pub enum DockAnchor {
|
|||
Expanded,
|
||||
}
|
||||
|
||||
impl Bind for DockAnchor {
|
||||
fn bind(&self, statement: &Statement, start_index: i32) -> anyhow::Result<i32> {
|
||||
match self {
|
||||
DockAnchor::Bottom => "Bottom",
|
||||
DockAnchor::Right => "Right",
|
||||
DockAnchor::Expanded => "Expanded",
|
||||
}
|
||||
.bind(statement, start_index)
|
||||
}
|
||||
}
|
||||
|
||||
impl Column for DockAnchor {
|
||||
fn column(statement: &mut Statement, start_index: i32) -> anyhow::Result<(Self, i32)> {
|
||||
String::column(statement, start_index).and_then(|(anchor_text, next_index)| {
|
||||
Ok((
|
||||
match anchor_text.as_ref() {
|
||||
"Bottom" => DockAnchor::Bottom,
|
||||
"Right" => DockAnchor::Right,
|
||||
"Expanded" => DockAnchor::Expanded,
|
||||
_ => bail!("Stored dock anchor is incorrect"),
|
||||
},
|
||||
next_index,
|
||||
))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct SettingsFileContent {
|
||||
pub experiments: Option<FeatureFlags>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue