@@ -1383,8 +1383,19 @@ export class SymbolInformation {
1383
1383
}
1384
1384
}
1385
1385
1386
+ @es5ClassCompat
1387
+ export class DocumentSymbol {
1388
+
1389
+ static validate ( candidate : DocumentSymbol ) : void {
1390
+ if ( ! candidate . name ) {
1391
+ throw new Error ( 'name must not be falsy' ) ;
1392
+ }
1393
+ if ( ! candidate . range . contains ( candidate . selectionRange ) ) {
1394
+ throw new Error ( 'selectionRange must be contained in fullRange' ) ;
1395
+ }
1396
+ candidate . children ?. forEach ( DocumentSymbol . validate ) ;
1397
+ }
1386
1398
1387
- abstract class AbstractDocumentSymbol {
1388
1399
name : string ;
1389
1400
detail : string ;
1390
1401
kind : SymbolKind ;
@@ -1400,56 +1411,11 @@ abstract class AbstractDocumentSymbol {
1400
1411
this . range = range ;
1401
1412
this . selectionRange = selectionRange ;
1402
1413
this . children = [ ] ;
1403
- }
1404
- }
1405
-
1406
- @es5ClassCompat
1407
- export class DocumentSymbol extends AbstractDocumentSymbol {
1408
-
1409
- static validate ( candidate : DocumentSymbol ) : void {
1410
- if ( ! candidate . name ) {
1411
- throw new Error ( 'name must not be falsy' ) ;
1412
- }
1413
- if ( ! candidate . range . contains ( candidate . selectionRange ) ) {
1414
- throw new Error ( 'selectionRange must be contained in fullRange' ) ;
1415
- }
1416
- candidate . children ?. forEach ( DocumentSymbol . validate ) ;
1417
- }
1418
1414
1419
- constructor ( name : string , detail : string , kind : SymbolKind , range : Range , selectionRange : Range ) {
1420
- super ( name , detail , kind , range , selectionRange ) ;
1421
1415
DocumentSymbol . validate ( this ) ;
1422
1416
}
1423
-
1424
- static override [ Symbol . hasInstance ] ( candidate : unknown ) : boolean {
1425
- if ( ! isObject ( candidate ) ) {
1426
- throw new TypeError ( ) ;
1427
- }
1428
- return candidate instanceof AbstractDocumentSymbol
1429
- || candidate instanceof SymbolInformationAndDocumentSymbol ;
1430
- }
1431
1417
}
1432
1418
1433
- // This is a special type that's used from the `vscode.executeDocumentSymbolProvider` API
1434
- // command which implements both shapes, vscode.SymbolInformation _and_ vscode.DocumentSymbol
1435
- export class SymbolInformationAndDocumentSymbol extends SymbolInformation implements vscode . DocumentSymbol {
1436
-
1437
- detail : string ;
1438
- range : vscode . Range ;
1439
- selectionRange : vscode . Range ;
1440
- children : vscode . DocumentSymbol [ ] ;
1441
- override containerName : string ;
1442
-
1443
- constructor ( name : string , kind : vscode . SymbolKind , detail : string , containerName : string , uri : URI , range : Range , selectionRange : Range , children ?: SymbolInformationAndDocumentSymbol [ ] ) {
1444
- super ( name , kind , containerName , new Location ( uri , range ) ) ;
1445
-
1446
- this . containerName = containerName ;
1447
- this . detail = detail ;
1448
- this . range = range ;
1449
- this . selectionRange = selectionRange ;
1450
- this . children = children ?? [ ] ;
1451
- }
1452
- }
1453
1419
1454
1420
export enum CodeActionTriggerKind {
1455
1421
Invoke = 1 ,
0 commit comments