1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const File_1 = require("../../project/File");
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function toSourceLocation(f, content, offset) {
|
12 | if (!content || offset < 0 || offset > content.length - 1) {
|
13 | return undefined;
|
14 | }
|
15 | const lines = content.substr(0, offset)
|
16 | .split("\n");
|
17 | return {
|
18 | path: File_1.isFile(f) ? f.path : f,
|
19 | lineFrom1: lines.length,
|
20 | columnFrom1: lines[lines.length - 1].length + 1,
|
21 | offset,
|
22 | };
|
23 | }
|
24 | exports.toSourceLocation = toSourceLocation;
|
25 |
|
\ | No newline at end of file |