18
19
private static hasOpenBrace(scanner: JSONScanner): boolean {
21
>
while (scanner.scan() !== JSONSyntaxKind.EOF) {
22
>
const kind = scanner.getToken();
23
>
24
>
if (kind === JSONSyntaxKind.OpenBraceToken) {
25
return true;
26
}
28
29
return false;
31
32
private static offsetToPosition(model: ITextModel, offset: number): Position {
34
>
const eolLength = model.getEOL().length;
35
>
const lineCount = model.getLineCount();
36
>
for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {
37
>
const lineTotalLength = model.getLineLength(lineNumber) + eolLength;
38
>
const offsetAfterLine = offsetBeforeLine + lineTotalLength;
39
>
40
>
if (offsetAfterLine > offset) {
41
>
return new Position(
42
>
lineNumber,
43
>
offset - offsetBeforeLine + 1
44
>
);
45
>
}
46
>
offsetBeforeLine = offsetAfterLine;
47
>
}
48
return new Position(
49
lineCount,
50
model.getLineMaxColumn(lineCount)
51
);
53
54
static insertSnippet(model: ITextModel, _position: Position): InsertSnippetResult {