Skip to main content

code_frame_columns

Function code_frame_columns 

Source
pub fn code_frame_columns(
    source: String,
    location: NapiCodeFrameLocation,
    options: Option<NapiCodeFrameOptions>,
) -> Result<Option<String>>
Expand description

Renders a code frame showing the location of an error in source code

This is a Rust implementation that replaces Babel’s code-frame for better:

  • Performance on large files
  • Handling of long lines
  • Memory efficiency

§Arguments

  • source - The source code to render
  • location - The location to highlight (line and column numbers are 1-indexed)
  • options - Optional configuration

§Returns

The formatted code frame string, or undefined if the location is out of range (e.g., empty source or line number past end of file).