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

Add macro call in snippet #4378

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

clint419
Copy link
Contributor

@clint419 clint419 commented Nov 9, 2023

This change is Reviewable

@clint419
Copy link
Contributor Author

clint419 commented Nov 9, 2023

@orizi
Hi, I've added some macro call methods to the snippet in vscode-cairo to see if you can merge them. Thank you

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 7 unresolved discussions (waiting on @clint419)


vscode-cairo/snippets/cairo.json line 217 at r1 (raw file):

    "body": ["assert!($1, '$2');"],
    "description": "Creates an simple test"
  },

I think - as it can work without - and in any case - " instead of '

Suggestion:

  "Creates an assertion with macro": {
    "prefix": "assert",
    "body": ["assert!($1);"],
    "description": "Creates an simple test"
  },

vscode-cairo/snippets/cairo.json line 222 at r1 (raw file):

    "body": ["assert_eq!($1, $2, '$3');"],
    "description": "Creates an simple test"
  },

I think - as it can work without - and in any case - " instead of '

Suggestion:

  "Creates an equality assertion with macro": {
    "prefix": "assert",
    "body": ["assert_eq!($1, $2);"],
    "description": "Creates an simple test"
  },

vscode-cairo/snippets/cairo.json line 227 at r1 (raw file):

    "body": ["panic!($1);"],
    "description": "Creates panic"
  },

Suggestion:

  "Creates panic": {
    "prefix": "panic",
    "body": ["panic!(\"$1\");"],
    "description": "Creates panic"
  },

vscode-cairo/snippets/cairo.json line 232 at r1 (raw file):

    "body": ["format!('$1', $2);"],
    "description": "Creates a String using interpolation of expressions"
  },

and in all other direct formats styles - as only the string format arg is a must.

Suggestion:

  "Creates a String using interpolation of expressions": {
    "prefix": "format",
    "body": ["format!("$1");"],
    "description": "Creates a String using interpolation of expressions"
  },

vscode-cairo/snippets/cairo.json line 262 at r1 (raw file):

    "body": ["selector!($1);"],
    "description": "Creates a selector"
  },

Suggestion:

  "Creates a selector": {
    "prefix": "selector",
    "body": ["selector!(\"$1\");"],
    "description": "Creates a selector"
  },

vscode-cairo/snippets/cairo.json line 267 at r1 (raw file):

    "body": ["component!($1, $2);"],
    "description": "Creates a component"
  },

note this is not in statement context - so i'm not sure if this should behave differently.

Suggestion:

  "Declares a component usage": {
    "prefix": "component",
    "body": ["component!(path: $1, storage: $2, event: $3);"],
    "description": "Declares a component usage"
  },

vscode-cairo/snippets/cairo.json line 277 at r1 (raw file):

    "body": ["get_dep_component_mut!($1, $2);"],
    "description": "Get a mutable component"
  }

Suggestion:

  "Get a mutable component": {
    "prefix": "get_dep_component_mut",
    "body": ["get_dep_component_mut!(ref $1, $2);"],
    "description": "Get a mutable component"
  }

@clint419
Copy link
Contributor Author

clint419 commented Nov 9, 2023

@orizi
Thank you for your suggestion. In PR, some changes need to be made, and now, it has been adjusted according to the suggestions

Copy link
Contributor Author

@clint419 clint419 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 7 unresolved discussions (waiting on @orizi)


vscode-cairo/snippets/cairo.json line 217 at r1 (raw file):

Previously, orizi wrote…

I think - as it can work without - and in any case - " instead of '

Done.


vscode-cairo/snippets/cairo.json line 222 at r1 (raw file):

Previously, orizi wrote…

I think - as it can work without - and in any case - " instead of '

Done.


vscode-cairo/snippets/cairo.json line 227 at r1 (raw file):

    "body": ["panic!($1);"],
    "description": "Creates panic"
  },

Done.


vscode-cairo/snippets/cairo.json line 232 at r1 (raw file):

Previously, orizi wrote…

and in all other direct formats styles - as only the string format arg is a must.

Done.


vscode-cairo/snippets/cairo.json line 262 at r1 (raw file):

    "body": ["selector!($1);"],
    "description": "Creates a selector"
  },

Done.


vscode-cairo/snippets/cairo.json line 267 at r1 (raw file):

Previously, orizi wrote…

note this is not in statement context - so i'm not sure if this should behave differently.

Done.


vscode-cairo/snippets/cairo.json line 277 at r1 (raw file):

    "body": ["get_dep_component_mut!($1, $2);"],
    "description": "Get a mutable component"
  }

Done.

Copy link
Contributor Author

@clint419 clint419 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @orizi)

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @clint419)

@orizi orizi enabled auto-merge November 9, 2023 12:07
@orizi orizi added this pull request to the merge queue Nov 9, 2023
Merged via the queue into starkware-libs:main with commit af32da1 Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants