Skip to content
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

fix some errors #196

Merged
merged 5 commits into from
Jan 12, 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
15 changes: 4 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
- repo: https://github.com/biomejs/pre-commit
rev: "v0.4.0"
hooks:
- id: prettier
- id: biome-check
additional_dependencies: ["@biomejs/biome@1.9.4"]

- repo: local
hooks:
Expand All @@ -28,11 +29,3 @@ repos:
language: system
types_or: [toml]
entry: taplo format

- repo: local
hooks:
- id: clang-format
name: clang-format
language: system
types_or: [c, c++, cuda]
entry: clang-format -i --style=file
129 changes: 122 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ thiserror = "2.0"
lazy-regex = "3.4"
chrono = "0.4"
derive = { path = "./derive" }
lazy_static = "1.5"
rust-embed = "8.5"
rusqlite = { version = "0.32.1", features = ["bundled"] }
itertools = "0.14.0"

[package.metadata.deb]
assets = [
Expand Down
57 changes: 57 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space",
"indentWidth": 4
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"arrowParentheses": "asNeeded",
"indentWidth": 2
}
},
"json": {
"formatter": {
"indentWidth": 2
}
},
"linter": {
"rules": {
"correctness": {
"noUnusedImports": "warn",
"noUnusedVariables": "warn",
"useExhaustiveDependencies": "off"
},
"style": {
"useConst": "warn",
"useNamingConvention": {
"level": "warn",
"options": {
"requireAscii": true,
"strictCase": true
}
}
},
"complexity": {
"noForEach": "off"
},
"security": {
"noDangerouslySetInnerHtml": "off"
},
"a11y": {
"useKeyWithClickEvents": "off"
},
"nursery": {
"useSortedClasses": {
"level": "warn",
"fix": "safe"
}
}
}
}
}
4 changes: 4 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
vscode_version = "1.84.2"
autogen_warning = "# Warning, this file is autogenerated by nix4vscode. Don't modify this manually."

[[extensions]]
publisher_name = "ms-python"
extension_name = "debugpy"

[[extensions]]
publisher_name = "42crunch"
extension_name = "vscode-openapi"
Expand Down
2 changes: 1 addition & 1 deletion src/code/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use derive::api;
use serde::{Deserialize, Serialize};

// https://github.com/microsoft/vscode/blob/d187d50a482ff80dcf74c35affb09dda1a7cd2fe/src/vs/platform/extensions/common/extensions.ts
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Hash, Eq, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum TargetPlatform {
Win32X64,
Expand Down
4 changes: 2 additions & 2 deletions src/code/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! texpr {
}

#[derive(Debug, Clone, Default)]
struct IParsedVersion {
pub struct IParsedVersion {
has_caret: bool,
has_greater_equals: bool,
major_base: u64,
Expand All @@ -27,7 +27,7 @@ struct IParsedVersion {
}

impl IParsedVersion {
fn new(version: &str) -> anyhow::Result<Self> {
pub fn new(version: &str) -> anyhow::Result<Self> {
let version = version.trim();
if version == "*" {
return Ok(Default::default());
Expand Down
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::anyhow;
use lazy_regex::regex;
use serde::{Deserialize, Serialize};
use tokio::fs;

use crate::jinja::{Generator, SystemContext};

Expand All @@ -22,6 +23,11 @@ pub struct Config {
}

impl Config {
pub async fn from_file(path: &str) -> anyhow::Result<Self> {
let content = fs::read_to_string(path).await?;
Self::new(&content)
}

pub fn new(content: &str) -> anyhow::Result<Self> {
let mut obj: Config = toml::from_str(content)?;
let reg = regex!(r#"(\d+.\d+.\d+)(.*)?"#)
Expand Down
Loading
Loading