Skip to main content

handle_extract_function

Function handle_extract_function 

Source
pub fn handle_extract_function(req: &RawRequest, ctx: &AppContext) -> Response
Expand description

Handle an extract_function request.

Params:

  • file (string, required) — target file path
  • name (string, required) — name for the new function
  • start_line (u32, required) — first line of the range to extract (1-based)
  • end_line (u32, required) — last line (exclusive, 1-based) of the range to extract
  • dry_run (bool, optional) — if true, return diff without writing

Returns on success: { file, name, parameters, return_type, extracted_range, call_site_range, syntax_valid, backup_id }

Error codes:

  • unsupported_language — file is not TS/JS/TSX/Python
  • this_reference_in_range — range contains this/self