Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix(config reset when syncing config) #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
clearloop merged 2 commits into clearloop:master from RGFTheCoder:fix/config_reset_with_lang
Oct 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flake.nix
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

# Env vars
# a nightly compiler is required unless we use this cheat code.
RUSTC_BOOTSTRAP = 0;
RUSTC_BOOTSTRAP = 1;

# CFG_RELEASE = "${rustPlatform.rust.rustc.version}-stable";
CFG_RELEASE_CHANNEL = "stable";
Expand All @@ -104,6 +104,8 @@
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
RUST_BACKTRACE = "full";
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
RUSTC_BOOTSTRAP = 1;
CFG_RELEASE_CHANNEL = "stable";
};
}
);
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain.toml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ components = [
"rustfmt",
"clippy",
"rust-analyzer",
"rust-src"
]
profile = "minimal"
40 changes: 30 additions & 10 deletions src/config/code.rs
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
//! Code in config
use serde::{Deserialize, Serialize};

const PICK_DEFAULT: &str = "${fid}.${slug}";
fn default_pick() -> String {
"${fid}.${slug}".into()
PICK_DEFAULT.into()
}

const SUBMISSION_DEFAULT: &str = "${fid}.${slug}.${sid}.${ac}";
fn default_submission() -> String {
"${fid}.${slug}.${sid}.${ac}".into()
SUBMISSION_DEFAULT.into()
}

fn is_default_pick(t: &String) -> bool {
t == PICK_DEFAULT
}

fn is_default_submission(t: &String) -> bool {
t == SUBMISSION_DEFAULT
}

fn is_default_string(t: &String) -> bool {
t.is_empty()
}
fn is_default_bool(t: &bool) -> bool {
!t
}

/// Code config
Expand All @@ -18,26 +35,29 @@ pub struct Code {
pub editor_args: Option<Vec<String>>,
#[serde(rename(serialize = "editor-envs"), alias = "editor-envs", default)]
pub editor_envs: Option<Vec<String>>,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_bool")]
pub edit_code_marker: bool,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_string")]
pub start_marker: String,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_string")]
pub end_marker: String,
#[serde(rename(serialize = "inject_before"), alias = "inject_before", default)]
pub inject_before: Option<Vec<String>>,
#[serde(rename(serialize = "inject_after"), alias = "inject_after", default)]
pub inject_after: Option<Vec<String>>,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_bool")]
pub comment_problem_desc: bool,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_string")]
pub comment_leading: String,
#[serde(default, skip_serializing)]
#[serde(default, skip_serializing_if = "is_default_bool")]
pub test: bool,
pub lang: String,
#[serde(default = "default_pick", skip_serializing)]
#[serde(default = "default_pick", skip_serializing_if = "is_default_pick")]
pub pick: String,
#[serde(default = "default_submission", skip_serializing)]
#[serde(
default = "default_submission",
skip_serializing_if = "is_default_submission"
)]
pub submission: String,
}

Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /