From 1549ef6fe9a228cebab71915e66d5fc7a57a99fe Mon Sep 17 00:00:00 2001 From: Liam Allan Date: Fri, 5 May 2023 11:58:03 -0400 Subject: [PATCH] Workspace symbols now includes programs with main Signed-off-by: Liam Allan --- .../src/providers/project/workspaceSymbol.ts | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/server/src/providers/project/workspaceSymbol.ts b/server/src/providers/project/workspaceSymbol.ts index 4d3b0990..2ddd2e44 100644 --- a/server/src/providers/project/workspaceSymbol.ts +++ b/server/src/providers/project/workspaceSymbol.ts @@ -27,41 +27,44 @@ export default function workspaceSymbolProvider(params: WorkspaceSymbolParams): ) ) ) - } else if (baseNameLower.includes(`.pgm.`)) { - symbols.push( - WorkspaceSymbol.create( - basename, - SymbolKind.Method, - uri, - Range.create( - 0, - 0, - 0, - 0 - ) - ) - ) } else { const cache = parser.getParsedCache(uri); if (cache) { - cache.procedures.forEach(proc => { - if (proc.keyword[`EXPORT`]) { - symbols.push( - WorkspaceSymbol.create( - proc.name, - SymbolKind.Function, - uri, - Range.create( - proc.position.line, - 0, - proc.position.line, - 0 - ) + if (cache.keyword[`MAIN`]) { + symbols.push( + WorkspaceSymbol.create( + basename, + SymbolKind.Method, + uri, + Range.create( + 0, + 0, + 0, + 0 ) - ); - } - }); + ) + ); + } else + if (cache.keyword[`NOMAIN`]) { + cache.procedures.forEach(proc => { + if (proc.keyword[`EXPORT`]) { + symbols.push( + WorkspaceSymbol.create( + proc.name, + SymbolKind.Function, + uri, + Range.create( + proc.position.line, + 0, + proc.position.line, + 0 + ) + ) + ); + } + }); + } } } });