Title Case transform: recognize camelCase word boundaries#308699
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
Title Case transform: recognize camelCase word boundaries#308699yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The 'Transform to Title Case' command now splits camelCase identifiers at word boundaries before applying title case. For example, 'SrecParserLoadFromFile' is now correctly transformed to 'Srec Parser Load From File' instead of 'Srecparserloadfromfile'. This reuses the same caseBoundary and singleLetters regex patterns from SnakeCaseAction to detect camelCase transitions. Fixes microsoft#168979
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #168979
The "Transform to Title Case" command now recognizes camelCase word boundaries before applying the transformation. Previously,
SrecParserLoadFromFilewould be lowercased tosrecparserloadfromfileand then only the first letter would be capitalized, producingSrecparserloadfromfile. Now it correctly producesSrec Parser Load From File.The implementation reuses the same
caseBoundaryandsingleLettersregex patterns already used bySnakeCaseActionto detect camelCase transitions (lowercase-to-uppercase and acronym boundaries likeHTMLString). Before lowercasing and applying the title boundary regex, the text is first split at camelCase boundaries by inserting spaces.Examples:
SrecParserLoadFromFileSrecparserloadfromfileSrec Parser Load From FileparseHTMLStringParsehtmlstringParse Html StringgetElementByIdGetelementbyidGet Element By IdcamelCaseWordCamelcasewordCamel Case Wordhello worldHello WorldHello World(unchanged)Test plan
SrecParserLoadFromFile,parseHTMLString,getElementById,XMLHttpRequest,camelCaseWord,simple)npm run compile-check-ts-native)scripts/test.sh