Skip to content

Atomic Identifiers

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”.

Without atomic mode, compound identifiers are split at word boundaries:

Terminal window
# Without atomic mode
DocSpring 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.

With atomic identifiers, compound identifiers are preserved as single units:

Terminal window
# With atomic mode
DocSpring docspring (snake_case)
DocSpring docspring (kebab-case)
DocSpring DOCSPRING (SCREAMING_SNAKE_CASE)
DocSpring DocSpring (PascalCase - preserved)

You can enable atomic identifiers using CLI flags:

Terminal window
# Both search and replace terms are atomic
renamify rename FormAPI DocSpring --atomic-identifiers

You can configure commonly used atomic identifiers in .renamify/config.toml:

# List of identifiers that should always be treated as atomic
atomic = ["DocSpring", "GitHub", "FormAPI"]

When configured identifiers are detected, they’re automatically treated as atomic without needing CLI flags.

You can override the configuration file settings:

Terminal window
# Override config to allow word boundaries
renamify rename DocSpring doc_spring --no-atomic-search
# Override for search term only
renamify rename DocSpring Helper --no-atomic-search
# Override for replace term only
renamify rename OldName DocSpring --no-atomic-replace

When renaming “FormAPI” to “DocSpring” with atomic mode:

Terminal window
renamify rename FormAPI DocSpring --atomic-identifiers

Results:

  • FormAPIControllerDocSpringController
  • formapi_clientdocspring_client
  • FORMAPI_TOKENDOCSPRING_TOKEN
  • useFormAPIHookuseDocSpringHook

Atomic identifiers are preserved even when they appear as part of larger identifiers:

Terminal window
# GitHub is atomic
GitHubActions GitHubActions (preserved in PascalCase)
github_api github_api (preserved as single unit)
GITHUB_TOKEN GITHUB_TOKEN (preserved as single unit)

When an identifier is atomic, case transformations follow these rules:

Case StyleNon-AtomicAtomic
snake_casedoc_springdocspring
kebab-casedoc-springdocspring
camelCasedocSpringdocspring
PascalCaseDocSpringDocSpring
SCREAMING_SNAKE_CASEDOC_SPRINGDOCSPRING
Train-CaseDoc-SpringDocspring
lowercasedocspringdocspring
UPPERCASEDOCSPRINGDOCSPRING

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.

  1. Configure Common Brand Names: Add frequently used brand names to your .renamify/config.toml
  2. Use for Compound Words: Apply atomic mode to compound brand names and technical terms that should remain unified
  3. Consider Context: Use atomic mode when the identifier’s meaning depends on being a single unit
  4. Test First: Use --dry-run to preview how atomic mode affects your renaming
  1. Token Parsing: When atomic mode is enabled, the identifier bypasses normal word boundary detection
  2. Variant Generation: Only case variants are generated, not word-separated variants
  3. Pattern Matching: The atomic identifier is matched and replaced as a complete unit

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
  • 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.)