Description
openedon Jul 20, 2024
Issue Description
As a developer who frequently uses Visual Studio Code for projects involving web development and other programming tasks that often require the use of kebab-case
naming conventions (particularly in CSS, HTML, and certain JavaScript frameworks), I've noticed that the current snippet transformation capabilities in VSCode, while robust, do not include support for transforming string cases into kebab-case
.
Currently, VSCode supports the following formatters in snippets:
/upcase
- Transform to uppercase/downcase
- Transform to lowercase/capitalize
- Capitalize the first letter/camelcase
- Transform to camelCase/pascalcase
- Transform to PascalCase
Proposed Feature
I propose adding a new transformation option called /kebabcase
that would transform a string to kebab-case
. This transformation would be incredibly useful for developers working in environments where kebab-case
is a standard, such as in many CSS frameworks.
Rationale
Many projects, particularly those involving web technologies, utilize kebab-case
for class names, IDs, and other attributes. Built-in support in VSCode would aid in maintaining consistency across codebases.
Example Implementation
The transformation could be implemented similarly to the existing transformations, where a user can include something like $TM_SELECTED_TEXT/kebabcase
in their snippet definition to automatically convert the selected text into kebab-case
.