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

Remove non-breaking space at the beggining of comments #2091

Closed
Pierre-Sassoulas opened this issue Apr 7, 2021 · 6 comments · Fixed by #2092
Closed

Remove non-breaking space at the beggining of comments #2091

Pierre-Sassoulas opened this issue Apr 7, 2021 · 6 comments · Fixed by #2092
Labels
T: enhancement New feature or request

Comments

@Pierre-Sassoulas
Copy link
Contributor

Black apply a space after a # in comment like so:

- #Comment content 
+ # Comment content 

The thing is, often we developers fat fingers an insecable space after creating the # by not releasing the Alt Gr key fast enough.

Then black had a space before it resulting in visually two spaces:

- # Comment content 
+ #  Comment content 

I'd like black to remove insecable spaces at the beginning of comment and then replaces them with a real space:

- # Comment content 
+ # Comment content 
@Pierre-Sassoulas Pierre-Sassoulas added the T: enhancement New feature or request label Apr 7, 2021
@JelleZijlstra
Copy link
Collaborator

By "insecable space" do you mean the non-breaking space (nbsp) character https://www.compart.com/en/unicode/U+00A0 ? If so it seems reasonable to me for Black to replace leading nbsps in comments.

@Pierre-Sassoulas
Copy link
Contributor Author

Yes, sorry if it was not clear I translated the name from french.

@Pierre-Sassoulas Pierre-Sassoulas changed the title Remove insecable spaces at the beggining of comments Remove non-breaking space at the beggining of comments Apr 7, 2021
@Pierre-Sassoulas
Copy link
Contributor Author

I'm interested to work on this, if a pull request with this change is going to be merged.

@JelleZijlstra
Copy link
Collaborator

I'd merge it (unless someone else comes up with a problem with this suggestion).

Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 7, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 7, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 7, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 7, 2021
@Pierre-Sassoulas
Copy link
Contributor Author

I made an attempt, but I have a crash with type ignore comment for python 3.6 and 3.7 and I don't quite know what to do with it. Do you have an advise on how to debug it ?

@Pierre-Sassoulas
Copy link
Contributor Author

@ichard26 answered my question : #2092 (comment)

Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 11, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 11, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/black that referenced this issue Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants