Skip to content

Implement boundary selection functionality for select command #67

@devill

Description

@devill

Problem

The select command has boundary selection functionality that is currently not implemented, causing several tests to be skipped.

Current Status

Four boundary selection tests are currently skipped:

  • tests/fixtures/commands/select/boundary/arrow-function.input.ts
  • tests/fixtures/commands/select/boundary/class-method.input.ts
  • tests/fixtures/commands/select/boundary/inline-function.input.ts
  • tests/fixtures/commands/select/boundary/standalone-function.input.ts

What is Boundary Selection?

Boundary selection allows users to select code elements by their boundaries (e.g., entire function bodies, class methods, etc.) rather than precise character ranges.

Example Use Cases

# Select entire function including signature and body
refakts select myfile.ts --boundary function

# Select complete class method
refakts select myfile.ts --boundary method

# Select arrow function expression
refakts select myfile.ts --boundary arrow-function

Implementation Needed

1. Boundary Detection Logic

  • Function boundaries: Include signature, parameters, and complete body
  • Method boundaries: Include visibility modifiers, signature, and body
  • Arrow function boundaries: Include parameters and expression/body
  • Class boundaries: Include entire class definition

2. Selection Strategy

  • Extend existing selection strategies in src/core/services/selection/
  • Add boundary-specific pattern matching
  • Integrate with existing SelectCommand architecture

3. Output Format

  • Use existing SelectOutputHandler for consistent formatting
  • Return complete boundary ranges rather than partial selections

Related Skipped Tests

All tests use @skip annotation and need to be enabled after implementation:

  1. arrow-function.input.ts - Select arrow function boundaries
  2. class-method.input.ts - Select class method boundaries
  3. inline-function.input.ts - Select inline function boundaries
  4. standalone-function.input.ts - Select standalone function boundaries

Acceptance Criteria

  • Implement boundary selection strategy for functions
  • Implement boundary selection strategy for class methods
  • Implement boundary selection strategy for arrow functions
  • Add boundary selection options to select command
  • Update all 4 skipped boundary tests to pass:
    • arrow-function.input.ts
    • class-method.input.ts
    • inline-function.input.ts
    • standalone-function.input.ts
  • Remove @skip annotations from boundary tests
  • Update command help text to document boundary selection options

Priority

Medium - Enhances select command functionality but doesn't block existing features.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefakTS CommandIssues that introduce new commands to the productenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions