Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion generator/plugins/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []


Expand Down
2 changes: 1 addition & 1 deletion generator/plugins/rust/rust_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions generator/plugins/rust/rust_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<S>(&self, serializer: S) -> Result<S::Ok, S::Error> 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<D>(deserializer: D) -> Result<{enum.name}, D::Error> where D: serde::Deserializer<'de>,"
"{",
"let value = i32::deserialize(deserializer)?;",
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions generator/plugins/rust/rust_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
"}",
]
Expand Down
2 changes: 1 addition & 1 deletion generator/plugins/rust/rust_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading