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 CodeAction to convert Tab characters to spaces #416

Merged
merged 2 commits into from
Mar 1, 2021

Conversation

evidolob
Copy link
Collaborator

@evidolob evidolob commented Feb 25, 2021

What does this PR do?

This PR adds various things:

  • Improves yaml parser diagnostics reporting, now diagnostics has proper text regions
  • Collapse multiple Using tabs can lead to unpredictable results diagnostic in to one, previously we report each tab character separately
  • Add CodeAction to convert Tab characters to spaces

Demo:

Screen.Recording.2021-02-25.at.12.16.37.mov

Convert all tabs to spaces:

Screen.Recording.2021-02-25.at.17.08.27.mov

What issues does this PR fix or reference?

Fix: #244

Is it tested? How?

With new tests and manually, just create yaml file with tab's characters and see that Using tabs can lead to unpredictable results error has CodeAction Convert Tab to Spaces and when it executed tabs replaced with spaces according to current editor settings.

@evidolob
Copy link
Collaborator Author

cc @mickaelistria

@coveralls
Copy link

coveralls commented Feb 25, 2021

Coverage Status

Coverage increased (+0.4%) to 76.834% when pulling 722d860 on evidolob:add-tab-convert-action into 4ace948 on redhat-developer:master.

@mickaelistria
Copy link
Contributor

👍

Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

Just tried it out and everything was working for me! Just wondering if it also makes sense to have a code action with Convert all tabs to spaces so we don't have to do it multiple times. I assume if someone has tabs in their yaml file they probably just have a setting enabled that keeps tabs as tabs instead of tabs to spaces

@evidolob
Copy link
Collaborator Author

@JPinkney I added Convert all Tabs to Spaces action.

Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

Tried with the newest changes and everything seemed to be working 👍

@evidolob evidolob merged commit ed266ae into redhat-developer:master Mar 1, 2021
@evidolob evidolob deleted the add-tab-convert-action branch March 1, 2021 07:26
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.

Auto-Edit to turn indent tabs into indent spaces
4 participants