Skip to content

Commit

Permalink
fix expand rust macro
Browse files Browse the repository at this point in the history
  • Loading branch information
getong committed Oct 18, 2024
1 parent be1e69e commit 8874412
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/handler/rust_expand_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ def process_request(self, position) -> dict:
return dict(position=position)

def process_response(self, response: Union[dict, list]) -> None:
eval_in_emacs("lsp-bridge-rust-expand-macro--update", response["name"], response["expansion"])
if response is None:
# Handle the case when response is None
print("Error: Received None response from rust-analyzer")
return

# Ensure response has the keys we expect
if "name" in response and "expansion" in response:
eval_in_emacs("lsp-bridge-rust-expand-macro--update", response["name"], response["expansion"])
else:
# Handle the case where keys are missing
print(f"Error: Response missing 'name' or 'expansion' keys. Response: {response}")

0 comments on commit 8874412

Please sign in to comment.