Atomic Identifiers
Overview
Section titled “Overview”Atomic identifiers allow you to treat compound brand names and identifiers as indivisible units during case transformations. When an identifier is marked as atomic, Renamify preserves it as a single word without detecting internal word boundaries.
This feature is essential for maintaining brand identity and preventing incorrect word splitting in compound names like “DocSpring” or “GitHub”.
The Problem
Section titled “The Problem”Without atomic mode, compound identifiers are split at word boundaries:
# Without atomic modeDocSpring → doc_spring (snake_case)DocSpring → doc-spring (kebab-case)DocSpring → DOC_SPRING (SCREAMING_SNAKE_CASE)
These transformations break the brand identity and can cause issues when the name should remain as a single unit.
The Solution
Section titled “The Solution”With atomic identifiers, compound identifiers are preserved as single units:
# With atomic modeDocSpring → docspring (snake_case)DocSpring → docspring (kebab-case)DocSpring → DOCSPRING (SCREAMING_SNAKE_CASE)DocSpring → DocSpring (PascalCase - preserved)
With Atomic Identifiers
Section titled “With Atomic Identifiers”Command Line Flags
Section titled “Command Line Flags”You can enable atomic identifiers using CLI flags:
# Both search and replace terms are atomicrenamify rename FormAPI DocSpring --atomic-identifiers
# Only search term is atomicrenamify rename FormAPI Helper --atomic-search
# Only replace term is atomicrenamify rename OldName DocSpring --atomic-replace
Configuration File
Section titled “Configuration File”You can configure commonly used atomic identifiers in .renamify/config.toml
:
# List of identifiers that should always be treated as atomicatomic = ["DocSpring", "GitHub", "FormAPI"]
When configured identifiers are detected, they’re automatically treated as atomic without needing CLI flags.
Overriding Configuration
Section titled “Overriding Configuration”You can override the configuration file settings:
# Override config to allow word boundariesrenamify rename DocSpring doc_spring --no-atomic-search
# Override for search term onlyrenamify rename DocSpring Helper --no-atomic-search
# Override for replace term onlyrenamify rename OldName DocSpring --no-atomic-replace
Real-World Examples
Section titled “Real-World Examples”Renaming a Brand Name
Section titled “Renaming a Brand Name”When renaming “FormAPI” to “DocSpring” with atomic mode:
renamify rename FormAPI DocSpring --atomic-identifiers
Results:
FormAPIController
→DocSpringController
formapi_client
→docspring_client
FORMAPI_TOKEN
→DOCSPRING_TOKEN
useFormAPIHook
→useDocSpringHook
Partial Matching
Section titled “Partial Matching”Atomic identifiers are preserved even when they appear as part of larger identifiers:
# GitHub is atomicGitHubActions → GitHubActions (preserved in PascalCase)github_api → github_api (preserved as single unit)GITHUB_TOKEN → GITHUB_TOKEN (preserved as single unit)
Case Transformation Behavior
Section titled “Case Transformation Behavior”When an identifier is atomic, case transformations follow these rules:
Case Style | Non-Atomic | Atomic |
---|---|---|
snake_case | doc_spring | docspring |
kebab-case | doc-spring | docspring |
camelCase | docSpring | docspring |
PascalCase | DocSpring | DocSpring |
SCREAMING_SNAKE_CASE | DOC_SPRING | DOCSPRING |
Train-Case | Doc-Spring | Docspring |
lowercase | docspring | docspring |
UPPERCASE | DOCSPRING | DOCSPRING |
VS Code Extension
Section titled “VS Code Extension”The VS Code extension provides checkboxes for atomic mode:
- Atomic search: Treat the search term as an indivisible unit
- Atomic replace: Treat the replace term as an indivisible unit
These checkboxes include tooltips explaining their behavior and are automatically checked when terms match configured atomic identifiers.
Best Practices
Section titled “Best Practices”- Configure Common Brand Names: Add frequently used brand names to your
.renamify/config.toml
- Use for Compound Words: Apply atomic mode to compound brand names and technical terms that should remain unified
- Consider Context: Use atomic mode when the identifier’s meaning depends on being a single unit
- Test First: Use
--dry-run
to preview how atomic mode affects your renaming
Technical Details
Section titled “Technical Details”How It Works
Section titled “How It Works”- Token Parsing: When atomic mode is enabled, the identifier bypasses normal word boundary detection
- Variant Generation: Only case variants are generated, not word-separated variants
- Pattern Matching: The atomic identifier is matched and replaced as a complete unit
Performance
Section titled “Performance”Atomic mode has minimal performance impact:
- Detection happens during the parsing phase
- No additional scanning or regex operations required
- Config file is cached after first read
Limitations
Section titled “Limitations”- Atomic mode applies to the entire identifier - you cannot make part of an identifier atomic
- Case-insensitive matching is used for configured atomic identifiers
- Atomic identifiers should not contain delimiters (underscores, hyphens, etc.)
See Also
Section titled “See Also”- Case Transformations - Learn about supported case styles
- Configuration - Set up persistent atomic identifiers
- CLI Reference - Full command options