From c8460721fa6ed32ddf44d63122868c348182bbeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BOURREAU?= Date: Tue, 22 Oct 2024 13:32:28 +0200 Subject: [PATCH] fix(getIncludeFromDirective): ignore the comment line --- language/parser.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/language/parser.js b/language/parser.js index 9eb7cad9..0dbff257 100644 --- a/language/parser.js +++ b/language/parser.js @@ -126,7 +126,7 @@ export default class Parser { */ static getIncludeFromDirective(line) { if (line.includes(`*`)) return; // Likely comment - if (line.includes(`//`)) return; // Likely comment + if (line.trim().startsWith(`//`)) return; // Likely comment const upperLine = line.toUpperCase(); let comment = -1; @@ -441,23 +441,23 @@ export default class Parser { // End of parsing for this file break; } else - if (parts[0] === `/IF`) { + if (parts[0] === `/IF`) { // Directive IF - directIfScope += 1; - continue; - } else - if (parts[0] === `/ENDIF`) { - // Directive ENDIF - directIfScope -= 1; - continue; - } else - if (directIfScope > 0) { - // Ignore lines inside the IF scope. - continue; - } else - if (line.startsWith(`/`)) { - continue; - } + directIfScope += 1; + continue; + } else + if (parts[0] === `/ENDIF`) { + // Directive ENDIF + directIfScope -= 1; + continue; + } else + if (directIfScope > 0) { + // Ignore lines inside the IF scope. + continue; + } else + if (line.startsWith(`/`)) { + continue; + } } if (pieces.length > 1 && pieces[1].includes(`//`)) line = pieces[0] + `;`; @@ -671,9 +671,9 @@ export default class Parser { if (dsScopes.length === 1) { scope.structs.push(dsScopes.pop()); } else - if (dsScopes.length > 1) { - dsScopes[dsScopes.length - 2].subItems.push(dsScopes.pop()); - } + if (dsScopes.length > 1) { + dsScopes[dsScopes.length - 2].subItems.push(dsScopes.pop()); + } break; case `DCL-PR`: @@ -915,7 +915,7 @@ export default class Parser { if (currentSqlItem.name) - currentSqlItem.keywords = []; + currentSqlItem.keywords = []; currentSqlItem.description = qualifiedObjectPath.schema || ``; currentSqlItem.position = {