Skip to content

Commit feeb6ec

Browse files
committed
Provides a symbol's start and end positions instead of just its start position.
Signed-off-by: Markus Alexander Kuppe <[email protected]>
1 parent 3523dcb commit feeb6ec

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/symbols/tlaSymbols.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
430430
const location = opKind.location;
431431
const line = parseInt(location.line?.begin || '0') - 1;
432432
const col = parseInt(location.column?.begin || '0') - 1;
433+
const endLine = parseInt(location.line?.end || '0') - 1;
434+
const endCol = parseInt(location.column?.end || '0') - 1;
433435
const preComments = opKind['pre-comments'] || undefined;
434436
const level = parseInt(opKind.level);
435437
symbols.push(new TlaSymbolInformation(
@@ -438,7 +440,7 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
438440
opKind.location.filename,
439441
new vscode.Location(
440442
documentUri,
441-
new vscode.Position(line, col)
443+
new vscode.Range(line, col, endLine, endCol)
442444
),
443445
preComments,
444446
level
@@ -453,13 +455,15 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
453455
const location = theoremNode.location;
454456
const line = parseInt(location.line?.begin || '0') - 1;
455457
const col = parseInt(location.column?.begin || '0') - 1;
458+
const endLine = parseInt(location.line?.end || '0') - 1;
459+
const endCol = parseInt(location.column?.end || '0') - 1;
456460
symbols.push(new TlaSymbolInformation(
457461
name,
458462
vscode.SymbolKind.Boolean,
459463
theoremNode.location.filename,
460464
new vscode.Location(
461465
documentUri,
462-
new vscode.Position(line, col)
466+
new vscode.Range(line, col, endLine, endCol)
463467
)
464468
));
465469
}
@@ -472,13 +476,15 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
472476
const location = assumeNode.location;
473477
const line = parseInt(location.line?.begin || '0') - 1;
474478
const col = parseInt(location.column?.begin || '0') - 1;
479+
const endLine = parseInt(location.line?.end || '0') - 1;
480+
const endCol = parseInt(location.column?.end || '0') - 1;
475481
symbols.push(new TlaSymbolInformation(
476482
name,
477483
vscode.SymbolKind.Constructor,
478484
assumeNode.location.filename,
479485
new vscode.Location(
480486
documentUri,
481-
new vscode.Position(line, col)
487+
new vscode.Range(line, col, endLine, endCol)
482488
)
483489
));
484490
}
@@ -491,6 +497,8 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
491497
const location = declNode.location;
492498
const line = parseInt(location.line?.begin || '0') - 1;
493499
const col = parseInt(location.column?.begin || '0') - 1;
500+
const endLine = parseInt(location.line?.end || '0') - 1;
501+
const endCol = parseInt(location.column?.end || '0') - 1;
494502
const preComments = declNode['pre-comments'] || undefined;
495503
const level = parseInt(declNode.level); // Parse level from declaration
496504

@@ -500,7 +508,7 @@ export class TlaDocumentSymbolsProvider implements vscode.DocumentSymbolProvider
500508
declNode.location.filename,
501509
new vscode.Location(
502510
documentUri,
503-
new vscode.Position(line, col)
511+
new vscode.Range(line, col, endLine, endCol)
504512
),
505513
preComments,
506514
level

0 commit comments

Comments
 (0)