Skip to content

Commit de1cdb6

Browse files
committed
Fixes to outline indentation
1 parent 8ec2666 commit de1cdb6

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

out/documentSymbolProvider/documentSymbolProviderBase.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/documentSymbolProvider/documentSymbolProviderBase.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/documentSymbolProvider/documentSymbolProviderBase.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
2020
// prepare
2121
let symbols: vscode.DocumentSymbol[] = [];
2222
let containers: vscode.DocumentSymbol[] = [];
23+
let isWithinBank = false;
2324
let isWithinMethod = false;
2425
let isWithinData = false;
2526
let isWithinAsm = false;
@@ -72,6 +73,7 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
7273
// initialise
7374
symbolKind = vscode.SymbolKind.Class;
7475
isContainer = true;
76+
isWithinBank = true;
7577
isWithinMethod = false;
7678
isWithinData = false;
7779
isWithinAsm = false;
@@ -160,21 +162,18 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
160162
isContainer = false;
161163
isWithinData = false;
162164
isWithinAsm = false;
165+
isWithinMethod = false;
166+
isWithinFunctionOrMacro = false;
163167

164168
// set name (append hole number and noflow)
165169
symbolName = mainKeyword;
166170
if (keywords[0].length > 1) { symbolName += ` ${keywords[1]}`; }
167171
if (keywords[0].length > 2) { symbolDetail = keywords[2]; }
168172

169-
// inside function or macro?
170-
if (isWithinMethod || isWithinFunctionOrMacro) {
171-
// reset
173+
// reset container to root?
174+
while (containers.length > (isWithinBank ? 1 : 0)) {
172175
containers.pop();
173176
}
174-
175-
// reset
176-
isWithinMethod = false;
177-
isWithinFunctionOrMacro = false;
178177
break;
179178
default:
180179
// validate
@@ -192,7 +191,12 @@ export abstract class DocumentSymbolProviderBase implements vscode.DocumentSymbo
192191
if (isSubMethod) { symbolDetail = 'sub'; }
193192

194193
// 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+
}
196200

197201
// set
198202
isWithinMethod = true;

0 commit comments

Comments
 (0)