Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Multi Case ConverterNew to Visual Studio Code? Get it now.
Multi Case Converter

Multi Case Converter

JK XLN

|
2 installs
| (0) | Free
Convert selected text between multiple naming conventions with a single command.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Multi Case Converter (多命名格式转换器)

使用单个命令在多个命名约定之间转换所选文本。

功能特性

  • 轻松转换: 使用单个命令(多命名格式:转换选中内容)即可快速切换所选文本(或光标下的单词,如果未选择任何内容)的命名约定。
  • 支持多种格式: 支持常见的命名样式,包括:
    • camelCase (驼峰式)
    • PascalCase (帕斯卡式)
    • snake_case (蛇形式)
    • CONSTANT_CASE (常量式)
    • kebab-case (连字符式/参数式)
    • Header-Case (标题式)
    • lowercase (全小写)
    • UPPERCASE (全大写)
  • 灵活的转换模式:
    • 线性模式: 循环遍历用户定义的命名格式序列。
    • 链式模式: 使用显式映射定义特定格式之间的直接转换。
  • 高度可配置: 可通过设置自定义转换顺序或创建复杂的转换链。
  • 智能提示支持: 设置项在 VS Code 的 IntelliSense 中得到完全支持和文档说明,便于配置。

使用方法

  1. 选择要转换的文本(或者将光标置于待转换的单词上)。
  2. 触发命令 多命名格式:转换选中内容。你可以通过以下方式执行:
    • 命令面板: 按 Ctrl+Shift+P (Windows/Linux) 或 Cmd+Shift+P (Mac),输入 "Multi Case: Convert Selected Text" 并回车。
    • 默认快捷键: 按 Ctrl+Shift+U (Windows/Linux) 或 Cmd+Shift+U (Mac)。
    • 自定义快捷键: 你也可以在 VS Code 的键盘快捷方式设置中为该命令分配其他快捷键。
  3. 所选文本将根据你配置的转换方法和设置进行转换。

注意: 如果未选择任何文本,插件将尝试查找并转换光标下的单词。

配置

该扩展提供了两个主要设置来控制转换行为:

multiCase.conversionMethod

  • 类型: string
  • 默认值: "linear"
  • 选项:
    • "linear": 使用 multiCase.conversionOrder 中定义的顺序。
    • "chain": 使用 multiCase.conversionChain 中定义的映射。

multiCase.conversionOrder

  • 类型: array of strings
  • 默认值: ["camel", "pascal", "snake"]
  • 描述: 为 线性 转换模式定义命名格式的循环顺序。插件将按此顺序依次循环这些格式。
  • 有效项: camel, pascal, snake, constant, param, header, lower, upper
  • 示例: 将其设置为 ["snake", "param", "constant"] 会在 multi_case_converter -> multi-case-converter -> MULTI_CASE_CONVERTER -> multi_case_converter ... 之间循环。

multiCase.conversionChain

  • 类型: object
  • 默认值: {}
  • 描述: 为 链式 转换模式定义显式的转换映射。每个键是 检测到的源格式,其值是 期望的目标格式。如果当前格式在映射中找不到,则会回退到 multiCase.conversionOrder。
  • 有效键/值项: camel, pascal, snake, constant, param, header, lower, upper
  • 示例: {"camel": "snake", "snake": "pascal", "pascal": "camel"} 意味着:
    • multiCaseConverter (驼峰式) 变成 multi_case_converter (蛇形式)。
    • multi_case_converter (蛇形式) 变成 MultiCaseConverter (帕斯卡式)。
    • MultiCaseConverter (帕斯卡式) 变成 multiCaseConverter (驼峰式)。
  • 注意: 此设置仅在 multiCase.conversionMethod 设置为 "chain" 时生效。

示例工作流

  1. 选择 multiCaseConverter。
  2. 运行一次命令 (Ctrl+Shift+U) -> multiCaseConverter (如果从顺序开头开始) -> MultiCaseConverter。
  3. 再次运行命令 (Ctrl+Shift+U) -> MultiCaseConverter -> multi_case_converter。
  4. 再次运行命令 (Ctrl+Shift+U) -> multi_case_converter -> MULTI_CASE_CONVERTER。
  5. 依此类推,在定义的顺序中循环。

许可证

该项目采用 MIT 许可证。详情请参见 LICENSE 文件。


Multi Case Converter

Convert selected text between multiple naming conventions with a single command.

Features

  • Effortless Conversion: Quickly switch the naming convention of your selected text (or the word under the cursor if nothing is selected) using a single command (Multi Case: Convert Selected Text).
  • Multiple Formats Supported: Supports common naming styles including:
    • camelCase (Camel Case)
    • PascalCase (Pascal Case)
    • snake_case (Snake Case)
    • CONSTANT_CASE (Constant Case)
    • kebab-case (Param/Keabab Case)
    • Header-Case (Header Case)
    • lowercase (Lower Case)
    • UPPERCASE (Upper Case)
  • Flexible Conversion Modes:
    • Linear Mode: Cycle through a user-defined sequence of naming formats.
    • Chain Mode: Use an explicit mapping to define direct conversions between specific formats.
  • Highly Configurable: Customize the conversion order or create complex conversion chains via settings.
  • IntelliSense Support: Settings are fully documented and supported by VS Code's IntelliSense for easy configuration.

Usage

  1. Select the text you want to convert (or place the cursor on the word to convert).
  2. Trigger the command Multi Case: Convert Selected Text. You can do this via:
    • Command Palette: Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac), type "Multi Case: Convert Selected Text" and press Enter.
    • Default Shortcut: Press Ctrl+Shift+U (Windows/Linux) or Cmd+Shift+U (Mac).
    • Custom Shortcut: You can also assign a different shortcut in VS Code's Keyboard Shortcuts settings for this command.
  3. The selected text will be converted according to your configured conversion method and settings.

Note: If no text is selected, the extension will attempt to find and convert the word under the cursor.

Configuration

The extension offers two main settings for controlling the conversion behavior:

multiCase.conversionMethod

  • Type: string
  • Default Value: "linear"
  • Options:
    • "linear": Uses the order defined in multiCase.conversionOrder.
    • "chain": Uses the mapping defined in multiCase.conversionChain.

multiCase.conversionOrder

  • Type: array of strings
  • Default Value: ["camel", "pascal", "snake"]
  • Description: Defines the circular order of naming formats for the linear conversion mode. The plugin will cycle through these formats sequentially.
  • Valid Items: camel, pascal, snake, constant, param, header, lower, upper
  • Example: Setting it to ["snake", "param", "constant"] cycles multi_case_converter -> multi-case-converter -> MULTI_CASE_CONVERTER -> multi_case_converter ...

multiCase.conversionChain

  • Type: object
  • Default Value: {}
  • Description: Defines an explicit conversion map for the chain conversion mode. Each key is the detected source format, and its value is the desired target format. If the current format isn't found in the map, it falls back to multiCase.conversionOrder.
  • Valid Key/Value Items: camel, pascal, snake, constant, param, header, lower, upper
  • Example: {"camel": "snake", "snake": "pascal", "pascal": "camel"} means:
    • multiCaseConverter (camelCase) becomes multi_case_converter (snake_case).
    • multi_case_converter (snake_case) becomes MultiCaseConverter (PascalCase).
    • MultiCaseConverter (PascalCase) becomes multiCaseConverter (camelCase).
  • Note: This setting only applies when multiCase.conversionMethod is set to "chain".

Example Workflow

  1. Select multiCaseConverter.
  2. Run the command once (Ctrl+Shift+U) -> multiCaseConverter (if starting at the beginning of the order) -> MultiCaseConverter.
  3. Run the command again (Ctrl+Shift+U) -> MultiCaseConverter -> multi_case_converter.
  4. Run the command again (Ctrl+Shift+U) -> multi_case_converter -> MULTI_CASE_CONVERTER.
  5. And so on, cycling through the defined order.

License

This project is licensed under the MIT License. See the LICENSE file for details.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft