Skip to content

Fix: Transform to Snake Case now handles kebab-case input - #288817

Open
Milad Rashidikhah (Milad93R) wants to merge 1 commit into
microsoft:mainfrom
Milad93R:fix/snake-case-kebab-input
Open

Fix: Transform to Snake Case now handles kebab-case input#288817
Milad Rashidikhah (Milad93R) wants to merge 1 commit into
microsoft:mainfrom
Milad93R:fix/snake-case-kebab-input

Conversation

@Milad93R

Copy link
Copy Markdown

Summary

  • Added hyphenBoundary regex pattern to SnakeCaseAction to handle kebab-case input
  • Text like hello-this-is-kebab-case now correctly transforms to hello_this_is_kebab_case

Changes

  • src/vs/editor/contrib/linesOperations/browser/linesOperations.ts: Added hyphen boundary detection using the same pattern as KebabCaseAction uses for underscores
  • src/vs/editor/contrib/linesOperations/test/browser/linesOperations.test.ts: Added test case for kebab-case to snake_case conversion

Test plan

  • Added unit test for kebab-case to snake_case conversion
  • Verified existing snake_case transformation tests still work
  • Manually tested transformation logic with various inputs including:
    • hello-this-is-kebab-casehello_this_is_kebab_case
    • kebab-case-WITH-Mixedkebab_case_with_mixed
    • audio-converter.convert-M4A-to-MP3audio_converter.convert_m4a_to_mp3

Fixes #288603

Add hyphenBoundary regex pattern to SnakeCaseAction to convert hyphens
to underscores, allowing kebab-case text like 'hello-this-is-kebab-case'
to properly transform to 'hello_this_is_kebab_case'.

Fixes microsoft#288603
@Milad93R

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

"Transform to Snake Case" does nothing on kebab case text

3 participants