Skip to content

Remove non-ascii characters from internal code comments #53608

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

Merged

Conversation

dsherret
Copy link
Contributor

In Deno we now require 7-bit ascii for our internal code. When TypeScript builds, some of these characters end up in the build output. It seems like there weren't that many instances of non-ascii characters in TypeScript's comments so is it ok to remove them? It makes my life a little easier and makes the code a bit more consistent.

I only did a search for the characters that ended up in the build output in the "src" directory and nothing else.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 31, 2023
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@jakebailey
Copy link
Member

This seems okay, but, why is it a requirement for Deno? Can you exempt vendored code? How can we make sure to not regress? What if we add special characters to document something?

@dsherret
Copy link
Contributor Author

dsherret commented Mar 31, 2023

How can we make sure to not regress?

Don't worry about it on your side. Our code just fails to build and it's easy to workaround. Only about 4 of these comments actually ended up in the output so I think it's really rare.

What if we add special characters to document something?

At that point I'll just add something to transform them.

Why is it a requirement for Deno? Can you exempt vendored code?

No, it allows us to use v8 external one-byte strings which drastically reduces our snapshot size. Once one of these characters ends up in the code then it goes to utf-16.

@jakebailey
Copy link
Member

No, it allows us to use v8 external one-byte strings which drastically reduces our snapshot size. Once one of these characters ends up in the code then it goes to utf-16.

That's super interesting!

@@ -129,7 +129,7 @@ function getDeclarationSiteFix(context: CodeFixContext | CodeFixAllContext, expr
}
});
// No fix-all because it will already be included once with the use site fix,
// and for simplicity the fix-all doesnt let the user choose between use-site and declaration-site fixes.
// and for simplicity the fix-all doesn't let the user choose between use-site and declaration-site fixes.
Copy link
Member

Choose a reason for hiding this comment

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

Can't stop looking at this ‘ psuedoapostrophe

@RyanCavanaugh RyanCavanaugh merged commit 710e7d9 into microsoft:main Mar 31, 2023
@dsherret dsherret deleted the remove_non_ascii_chars_comments branch March 31, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants