@@ -20,6 +20,7 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
20
20
// prepare
21
21
let symbols : vscode . DocumentSymbol [ ] = [ ] ;
22
22
let containers : vscode . DocumentSymbol [ ] = [ ] ;
23
+ let isWithinBank = false ;
23
24
let isWithinMethod = false ;
24
25
let isWithinData = false ;
25
26
let isWithinAsm = false ;
@@ -72,6 +73,7 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
72
73
// initialise
73
74
symbolKind = vscode . SymbolKind . Class ;
74
75
isContainer = true ;
76
+ isWithinBank = true ;
75
77
isWithinMethod = false ;
76
78
isWithinData = false ;
77
79
isWithinAsm = false ;
@@ -160,21 +162,18 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
160
162
isContainer = false ;
161
163
isWithinData = false ;
162
164
isWithinAsm = false ;
165
+ isWithinMethod = false ;
166
+ isWithinFunctionOrMacro = false ;
163
167
164
168
// set name (append hole number and noflow)
165
169
symbolName = mainKeyword ;
166
170
if ( keywords [ 0 ] . length > 1 ) { symbolName += ` ${ keywords [ 1 ] } ` ; }
167
171
if ( keywords [ 0 ] . length > 2 ) { symbolDetail = keywords [ 2 ] ; }
168
172
169
- // inside function or macro?
170
- if ( isWithinMethod || isWithinFunctionOrMacro ) {
171
- // reset
173
+ // reset container to root?
174
+ while ( containers . length > ( isWithinBank ? 1 : 0 ) ) {
172
175
containers . pop ( ) ;
173
176
}
174
-
175
- // reset
176
- isWithinMethod = false ;
177
- isWithinFunctionOrMacro = false ;
178
177
break ;
179
178
default :
180
179
// validate
@@ -192,7 +191,12 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
192
191
if ( isSubMethod ) { symbolDetail = 'sub' ; }
193
192
194
193
// are we already in a method (and not a sub-method)
195
- if ( isContainer && ( isWithinMethod || isWithinFunctionOrMacro ) ) { containers . pop ( ) ; }
194
+ if ( isContainer && ( isWithinMethod || isWithinFunctionOrMacro ) )
195
+ {
196
+ while ( containers . length > ( isWithinBank ? 1 : 0 ) ) {
197
+ containers . pop ( ) ;
198
+ }
199
+ }
196
200
197
201
// set
198
202
isWithinMethod = true ;
0 commit comments