1
1
import * as atomIde from 'atom-ide' ;
2
+ import type { OutlineTree , Outline } from 'atom-ide-base'
2
3
import Convert from '../convert' ;
3
4
import * as Utils from '../utils' ;
4
5
import { CancellationTokenSource } from 'vscode-jsonrpc' ;
@@ -43,7 +44,7 @@ export default class OutlineViewAdapter {
43
44
* @param editor The Atom {TextEditor} containing the text the Outline should represent.
44
45
* @returns A {Promise} containing the {Outline} of this document.
45
46
*/
46
- public async getOutline ( connection : LanguageClientConnection , editor : TextEditor ) : Promise < atomIde . Outline | null > {
47
+ public async getOutline ( connection : LanguageClientConnection , editor : TextEditor ) : Promise < Outline | null > {
47
48
const results = await Utils . doWithCancellationToken ( connection , this . _cancellationTokens , ( cancellationToken ) =>
48
49
connection . documentSymbol ( { textDocument : Convert . editorToTextDocumentIdentifier ( editor ) } , cancellationToken ) ,
49
50
) ;
@@ -78,7 +79,7 @@ export default class OutlineViewAdapter {
78
79
* should be converted to an {Array} of {OutlineTree}.
79
80
* @returns An {Array} of {OutlineTree} containing the given symbols that the Outline View can display.
80
81
*/
81
- public static createHierarchicalOutlineTrees ( symbols : DocumentSymbol [ ] ) : atomIde . OutlineTree [ ] {
82
+ public static createHierarchicalOutlineTrees ( symbols : DocumentSymbol [ ] ) : OutlineTree [ ] {
82
83
// Sort all the incoming symbols
83
84
symbols . sort ( ( a , b ) => {
84
85
if ( a . range . start . line !== b . range . start . line ) {
@@ -117,7 +118,7 @@ export default class OutlineViewAdapter {
117
118
* should be converted to an {OutlineTree}.
118
119
* @returns An {OutlineTree} containing the given symbols that the Outline View can display.
119
120
*/
120
- public static createOutlineTrees ( symbols : SymbolInformation [ ] ) : atomIde . OutlineTree [ ] {
121
+ public static createOutlineTrees ( symbols : SymbolInformation [ ] ) : OutlineTree [ ] {
121
122
symbols . sort (
122
123
( a , b ) =>
123
124
( a . location . range . start . line === b . location . range . start . line
@@ -146,7 +147,7 @@ export default class OutlineViewAdapter {
146
147
return map ;
147
148
} , new Map ( ) ) ;
148
149
149
- const roots : atomIde . OutlineTree [ ] = [ ] ;
150
+ const roots : OutlineTree [ ] = [ ] ;
150
151
151
152
// Put each item within its parent and extract out the roots
152
153
for ( const item of allItems ) {
@@ -180,14 +181,14 @@ export default class OutlineViewAdapter {
180
181
}
181
182
182
183
private static _getClosestParent (
183
- candidates : atomIde . OutlineTree [ ] | null ,
184
- child : atomIde . OutlineTree ,
185
- ) : atomIde . OutlineTree | null {
184
+ candidates : OutlineTree [ ] | null ,
185
+ child : OutlineTree ,
186
+ ) : OutlineTree | null {
186
187
if ( candidates == null || candidates . length === 0 ) {
187
188
return null ;
188
189
}
189
190
190
- let parent : atomIde . OutlineTree | undefined ;
191
+ let parent : OutlineTree | undefined ;
191
192
for ( const candidate of candidates ) {
192
193
if (
193
194
candidate !== child &&
@@ -218,7 +219,7 @@ export default class OutlineViewAdapter {
218
219
* @param symbol The {DocumentSymbol} to convert to an {OutlineTree}.
219
220
* @returns The {OutlineTree} corresponding to the given {DocumentSymbol}.
220
221
*/
221
- public static hierarchicalSymbolToOutline ( symbol : DocumentSymbol ) : atomIde . OutlineTree {
222
+ public static hierarchicalSymbolToOutline ( symbol : DocumentSymbol ) : OutlineTree {
222
223
const icon = OutlineViewAdapter . symbolKindToEntityKind ( symbol . kind ) ;
223
224
224
225
return {
@@ -243,7 +244,7 @@ export default class OutlineViewAdapter {
243
244
* @param symbol The {SymbolInformation} to convert to an {OutlineTree}.
244
245
* @returns The {OutlineTree} equivalent to the given {SymbolInformation}.
245
246
*/
246
- public static symbolToOutline ( symbol : SymbolInformation ) : atomIde . OutlineTree {
247
+ public static symbolToOutline ( symbol : SymbolInformation ) : OutlineTree {
247
248
const icon = OutlineViewAdapter . symbolKindToEntityKind ( symbol . kind ) ;
248
249
return {
249
250
tokenizedText : [
0 commit comments