The chunkText() function is used to chunk large text into smaller, more manageable pieces. This functionality is useful when editing large text or source code files (i.e. 1k+ lines of code). This function will attempt to chunk code via natural breaks (e.g., functions, code blocks, etc) as long as the chunk limit is not exceeded. The minimum code that can be chunked is the currently visible lines in the editor regardless of the presence of natural breaks.

Parameters

  • viewingCode (required): The code or text to be chunked
  • limit (optional): The maximum number of lines or other units to include in the chunk. Starts from currently visible lines in the editor. Appends/removes text equally from the top and bottom of the chunk.
    • Default: Currently visible lines in editor
  • limitType (optional): The type of limit, currently supporting “LINES”
    • Default: “LINES”

Configuration

To use the chunkText() function, provide the necessary parameters in your prompt. For example:

{{ chunkText(developer.viewingCode, 200, "LINES").codeWithCaret }}