Skip to content

Should the command fixture input selection be indicated with markers? #81

@JayBazuzi

Description

@JayBazuzi

Consider this input:

/**
 * @description Rename a function argument
 * @command refakts rename "[function-argument.input.ts 6:22-6:30]" --to "newParam"
 */

function processData(oldParam: string, other: number): string {
  const result = oldParam.toUpperCase();
  return oldParam + result + other;
}

Problem

  • When reading this, it's difficult to know what is being renamed.
  • If we modify the input code, it's tedious to update the command line correctly.

Proposed solution

  • Use special comment markers to indicate the selection range.

Example

/**
 * @description Rename a function argument
 * @command refakts rename "[function-argument.input.ts {{CURRENT_SELECTION}}]" --to "newParam"
 */

function processData(/*|*/oldParam/*|*/: string, other: number): string {
  const result = oldParam.toUpperCase();
  return oldParam + result + other;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionIssues where community input is encouraged to help refine the ideaenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions