code_snippet


Description:

public string code_snippet (int max_lines = -1)

Get code snippet extracted from file_path + line_range.

Uses metadata.file_id to lookup File via folder.project_files, then uses buffer_provider to get code snippet using metadata.start_line and metadata.end_line. Caller must ensure the file buffer is loaded (e.g. via read_async) before calling this.

Parameters:

max_lines

Maximum number of lines to return (-1 for no limit)

Returns:

Code snippet as string, truncated to max_lines if specified