From d52599e3b7c74dd00dcea54e05ae35a85d0d83a3 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 28 Mar 2025 11:02:27 -0700 Subject: [PATCH 1/2] Fix: version check for CI --- .github/workflows/version_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_check.py b/.github/workflows/version_check.py index 46799338..c2a6602c 100644 --- a/.github/workflows/version_check.py +++ b/.github/workflows/version_check.py @@ -20,7 +20,7 @@ version = line.split("=")[1].strip().strip('"') year, minor, micro = version.split(".") today = datetime.date.today() - if int(year) not in [today.year, today.year + 1]: + if int(year) not in [today.year - 1, today.year, today.year + 1]: print(f"Version {version} year should be {today.year} or {today.year + 1}") sys.exit(1) From 253a895403126d5bd01e2e4e2bdb13412de5094d Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 28 Mar 2025 11:33:42 -0700 Subject: [PATCH 2/2] Fix: Formatting --- generator/plugins/python/utils.py | 2 +- generator/plugins/rust/rust_commons.py | 2 +- generator/plugins/rust/rust_enum.py | 6 +++--- generator/plugins/rust/rust_tests.py | 4 ++-- generator/plugins/rust/rust_utils.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/generator/plugins/python/utils.py b/generator/plugins/python/utils.py index 59a23f71..93c7db16 100644 --- a/generator/plugins/python/utils.py +++ b/generator/plugins/python/utils.py @@ -194,7 +194,7 @@ def _get_since( lines.append(f"{indent}# {_sanitize_comment(tag)}") return lines if spec.since: - return [f"{indent}# Since: { _sanitize_comment(spec.since)}"] + return [f"{indent}# Since: {_sanitize_comment(spec.since)}"] return [] diff --git a/generator/plugins/rust/rust_commons.py b/generator/plugins/rust/rust_commons.py index 7da67ef2..a5877918 100644 --- a/generator/plugins/rust/rust_commons.py +++ b/generator/plugins/rust/rust_commons.py @@ -297,7 +297,7 @@ def fix_lsp_method_name(name: str) -> str: def generate_special_enum(enum_name: str, items: List[str]) -> Dict[str, List[str]]: lines = [ "#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]", - f"pub enum {enum_name}" "{", + f"pub enum {enum_name}{{", ] for item in items: lines += indent_lines( diff --git a/generator/plugins/rust/rust_enum.py b/generator/plugins/rust/rust_enum.py index b1d60f2e..c24a6de9 100644 --- a/generator/plugins/rust/rust_enum.py +++ b/generator/plugins/rust/rust_enum.py @@ -16,13 +16,13 @@ def _get_enum_docs(enum: Union[model.Enum, model.EnumItem]) -> List[str]: def generate_serde(enum: model.Enum) -> List[str]: ser = [ - f"impl Serialize for {enum.name} " "{", + f"impl Serialize for {enum.name} {{", "fn serialize(&self, serializer: S) -> Result where S: serde::Serializer,{", "match self {", ] de = [ - f"impl<'de> Deserialize<'de> for {enum.name} " "{", + f"impl<'de> Deserialize<'de> for {enum.name} {{", f"fn deserialize(deserializer: D) -> Result<{enum.name}, D::Error> where D: serde::Deserializer<'de>," "{", "let value = i32::deserialize(deserializer)?;", @@ -54,7 +54,7 @@ def generate_enum(enum: model.Enum, types: TypeData) -> None: lines += ["#[derive(PartialEq, Debug, Eq, Clone)]"] else: lines += ["#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)]"] - lines += [f"pub enum {enum.name} " "{"] + lines += [f"pub enum {enum.name} {{"] for item in enum.values: if is_int: diff --git a/generator/plugins/rust/rust_tests.py b/generator/plugins/rust/rust_tests.py index b604076a..1601981a 100644 --- a/generator/plugins/rust/rust_tests.py +++ b/generator/plugins/rust/rust_tests.py @@ -15,14 +15,14 @@ def generate_test_code(spec: model.LSPModel, test_path: pathlib.Path) -> str: for request in spec.requests: request_name = get_name(request) lines += [ - f'"{request_name}" =>' "{", + f'"{request_name}" =>{{', f"return validate_type::<{request_name}>(result_type, data)", "}", ] for notification in spec.notifications: notification_name = get_name(notification) lines += [ - f'"{notification_name}" =>' "{", + f'"{notification_name}" =>{{', f"return validate_type::<{notification_name}>(result_type, data)", "}", ] diff --git a/generator/plugins/rust/rust_utils.py b/generator/plugins/rust/rust_utils.py index 5b72117b..86fbdb2a 100644 --- a/generator/plugins/rust/rust_utils.py +++ b/generator/plugins/rust/rust_utils.py @@ -59,7 +59,7 @@ def generate_lib_rs(spec: model.LSPModel) -> List[str]: "use serde::{Serialize, Deserialize};", "use std::collections::HashMap;", "use url::Url;", - "use rust_decimal::Decimal;" "", + "use rust_decimal::Decimal;", ] type_data = TypeData()