Skip to content

PromptScript API


Function: createLocation()

createLocation(file, line, column, offset?): SourceLocation

Defined in: core/src/utils/diagnostic.ts:166

Create a SourceLocation object.

Parameters

file

string

File path

line

number

Line number (1-indexed)

column

number

Column number (1-indexed)

offset?

number

Optional byte offset

Returns

SourceLocation

SourceLocation object

Example

createLocation('project.prs', 10, 5)
// { file: 'project.prs', line: 10, column: 5 }

createLocation('project.prs', 10, 5, 150)
// { file: 'project.prs', line: 10, column: 5, offset: 150 }