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

Code fixes should not change comments and white spaces #9999

Open
shenglol opened this issue Mar 4, 2023 · 2 comments
Open

Code fixes should not change comments and white spaces #9999

shenglol opened this issue Mar 4, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@shenglol
Copy link
Contributor

shenglol commented Mar 4, 2023

See examples below:

examples

@ghost ghost added the Needs: Triage 🔍 label Mar 4, 2023
@shenglol shenglol self-assigned this Mar 4, 2023
@shenglol shenglol added bug Something isn't working and removed Needs: Triage 🔍 labels Mar 4, 2023
@shenglol shenglol added this to the v0.16 milestone Mar 4, 2023
@StephenWeatherford
Copy link
Contributor

@shenglol It's really hard to follow the gif. I'm assuming your issue with the location parameter fix is that the comment is copied as well as the value into the parameter default value?

If there's a second issue in the gif, it's too fast to follow, could you please create a separate issue for it? Thx.

@shenglol
Copy link
Contributor Author

shenglol commented Mar 7, 2023

@StephenWeatherford I just realized that it's not just one or two cases but a general issue. Basically, most of our code fixes are affected. The issue is that when we create text replacements, we didn't take into account the fact that the syntax being removed / replaced may have leading, trailing or enclosed comments. As a result, the comments may get removed or duplicated. You can easily reproduce it by applying code fixes to a syntax node with leading or trailing comments.

We may need to review all the places where CodeReplacement is used to make sure we don't screw up comments and formtting.

@stephaniezyen stephaniezyen modified the milestones: v0.16, v0.17 Mar 30, 2023
@alex-frankel alex-frankel modified the milestones: v0.17, v0.18 May 8, 2023
@shenglol shenglol modified the milestones: v0.18, Committed Backlog, v1.0 May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

4 participants