@@ -10,7 +10,7 @@ import OutlineViewAdapter from "./outline-view-adapter"
10
10
11
11
/** Public: Adapts the documentSymbolProvider of the language server to the Outline View supplied by Atom IDE UI. */
12
12
export default class CallHierarchyAdapter {
13
- private _cancellationTokens : WeakMap < LanguageClientConnection , CancellationTokenSource > = new WeakMap ( )
13
+ private _cancellationTokens = new WeakMap < LanguageClientConnection , CancellationTokenSource > ( )
14
14
15
15
/**
16
16
* Public: Determine whether this adapter can be used to adapt a language server based on the serverCapabilities
@@ -20,7 +20,7 @@ export default class CallHierarchyAdapter {
20
20
* @returns A {Boolean} indicating adapter can adapt the server based on the given serverCapabilities.
21
21
*/
22
22
public static canAdapt ( serverCapabilities : ServerCapabilities ) : boolean {
23
- return ! ! serverCapabilities . callHierarchyProvider
23
+ return Boolean ( serverCapabilities . callHierarchyProvider )
24
24
}
25
25
26
26
/** Corresponds to lsp's CallHierarchyPrepareRequest */
@@ -53,11 +53,11 @@ export default class CallHierarchyAdapter {
53
53
return < CallHierarchyForAdapter < T > > {
54
54
type,
55
55
data : results ?. map ( convertCallHierarchyItem ) ?? [ ] ,
56
- itemAt ( n : number ) {
56
+ itemAt ( num : number ) {
57
57
if ( type === "incoming" ) {
58
- return < Promise < atomIde . CallHierarchy < T > > > this . adapter . getIncoming ( this . connection , this . data [ n ] . rawData )
58
+ return < Promise < atomIde . CallHierarchy < T > > > this . adapter . getIncoming ( this . connection , this . data [ num ] . rawData )
59
59
} else {
60
- return < Promise < atomIde . CallHierarchy < T > > > this . adapter . getOutgoing ( this . connection , this . data [ n ] . rawData )
60
+ return < Promise < atomIde . CallHierarchy < T > > > this . adapter . getOutgoing ( this . connection , this . data [ num ] . rawData )
61
61
}
62
62
} ,
63
63
connection,
@@ -74,9 +74,9 @@ export default class CallHierarchyAdapter {
74
74
)
75
75
return < CallHierarchyForAdapter < "incoming" > > {
76
76
type : "incoming" ,
77
- data : results ?. map ?. ( ( l ) => convertCallHierarchyItem ( l . from ) ) || [ ] ,
78
- itemAt ( n : number ) {
79
- return this . adapter . getIncoming ( this . connection , this . data [ n ] . rawData )
77
+ data : results ?. map ( ( res ) => convertCallHierarchyItem ( res . from ) ) ?? [ ] ,
78
+ itemAt ( num : number ) {
79
+ return this . adapter . getIncoming ( this . connection , this . data [ num ] . rawData )
80
80
} ,
81
81
connection,
82
82
adapter : this ,
@@ -92,9 +92,9 @@ export default class CallHierarchyAdapter {
92
92
)
93
93
return < CallHierarchyForAdapter < "outgoing" > > {
94
94
type : "outgoing" ,
95
- data : results ?. map ( ( l ) => convertCallHierarchyItem ( l . to ) ) || [ ] ,
96
- itemAt ( n : number ) {
97
- return this . adapter . getOutgoing ( this . connection , this . data [ n ] . rawData )
95
+ data : results ?. map ( ( res ) => convertCallHierarchyItem ( res . to ) ) ?? [ ] ,
96
+ itemAt ( num : number ) {
97
+ return this . adapter . getOutgoing ( this . connection , this . data [ num ] . rawData )
98
98
} ,
99
99
connection,
100
100
adapter : this ,
@@ -112,7 +112,7 @@ function convertCallHierarchyItem(rawData: CallHierarchyItem): CallHierarchyItem
112
112
...rawData . tags . reduce ( ( set , tag ) => {
113
113
// filter out null and remove duplicates
114
114
const entity = symbolTagToEntityKind ( tag )
115
- return entity == null ? set : set . add ( entity )
115
+ return entity === null ? set : set . add ( entity )
116
116
} , new Set < atomIde . SymbolTagKind > ( ) ) ,
117
117
]
118
118
: [ ] ,
0 commit comments