Skip to main content

cut_source

Function cut_source 

Source
pub fn cut_source(
    content: &str,
    lang_name: &str,
    target_line: u32,
    target_col: Option<u32>,
) -> Option<CutResult>
Expand description

Given source content, a language name, and a target position, find the containing scope, classify its children into keep/cut, and return the modified source with /* ... */ placeholders for cut regions.

The returned cut_source preserves the same number of lines as the displayed scope excerpt in the original file (scope_range.end - scope_range.start + 1), making line numbers stable for gutter rendering.