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 method CtStatement#comment() #2013

Closed
monperrus opened this issue May 30, 2018 · 7 comments · Fixed by #3494
Closed

add method CtStatement#comment() #2013

monperrus opened this issue May 30, 2018 · 7 comments · Fixed by #3494

Comments

@monperrus
Copy link
Collaborator

to comment code in the pretty-printed code, this is a traceable version of (#delete)

@tdurieux
Copy link
Collaborator

tdurieux commented Jun 6, 2018

Honestly, I'm against this. it had API footprint to spoon (that is already huge) and it can be done by the client side in one or two lines.
I think we should really pay attention the API footprint.

We can maybe create an utility class that contains "useful" method like this.

@LakshyAAAgrawal
Copy link
Contributor

Hey, Will this feature be added? If yes, can I work on this?

@monperrus
Copy link
Collaborator Author

Welcome to Spoon. Yes, feel free to make a pull-request, that's a good exercise :-)

@LakshyAAAgrawal
Copy link
Contributor

Sir, I tried reading about the problem and also looked into the similar thread about adding blank lines and about delete. I see that CtStatement extends CtElement interface, which already has the addComment method along with others related to comments.

Could you please clarify if what we want from CtStatement#comment() is

  1. to comment the current statement in the actual model of the code - like:
int i = 10;

becomes

// int i = 10;
  1. Or is it to add a comment for the statement.
int i = 10;

becomes

int i = 10; // Hi, I am a comment

I understand that 2 is already implemented. Is it something else we are trying to add?

@monperrus
Copy link
Collaborator Author

yes, the intention is the first semantics you describe.

LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 13, 2020
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 14, 2020
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 15, 2020
body and as child element of another block. Add test methods.
Fixes INRIA#2013
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 15, 2020
@LakshyAAAgrawal
Copy link
Contributor

Idea: Should there be a way to and is there a usecase for "uncomment" of a legal/valid statement which has been commented by using CtStatement#comment?

LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 15, 2020
@monperrus
Copy link
Collaborator Author

is there a usecase for "uncomment"

thanks for the proposal, that's not required for now IMHO.

LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 17, 2020
Remove #comment from CtClassImpl, CtUnaryOperatorImpl,
CtInvocationImpl and CtConstructorCallImpl
Based on comments and suggestions at INRIA#3494
Fixes INRIA#2013
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 17, 2020
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 18, 2020
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 19, 2020
LakshyAAAgrawal added a commit to LakshyAAAgrawal/spoon that referenced this issue Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants