diff options
Diffstat (limited to 'src/Lang/Cpp')
| -rw-r--r-- | src/Lang/Cpp/CppParser.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts index 3b13721..dcdfcba 100644 --- a/src/Lang/Cpp/CppParser.ts +++ b/src/Lang/Cpp/CppParser.ts @@ -400,8 +400,7 @@ export default class CppParser implements ICodeParser { while (linesToGet-- > 0) { // Check for end of expression. nextLine = new Position(nextLine.line + 1, nextLine.character); nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim(); - let finalSlice = 0; - let endOfDeclaration = false; + let finalSlice = -1; // Check if method has finished if curly brace is opened while // nesting is occuring. @@ -412,13 +411,11 @@ export default class CppParser implements ICodeParser { currentNest--; } else if (nextLineTxt[i] === "{" && currentNest === 0) { finalSlice = i; - endOfDeclaration = true; break; } else if ((nextLineTxt[i] === ";" || (nextLineTxt[i] === ":" && nextLineTxt[i - 1] !== ":" && nextLineTxt[i + 1] !== ":")) && currentNest === 0) { finalSlice = i; - endOfDeclaration = true; break; } } @@ -431,7 +428,7 @@ export default class CppParser implements ICodeParser { if (!this.isVsCodeAutoComplete(nextLineTxt)) { logicalLine += "\n"; - if (endOfDeclaration === true) { + if (finalSlice >= 0) { logicalLine += nextLineTxt.slice(0, finalSlice); } else { logicalLine += nextLineTxt; @@ -439,7 +436,7 @@ export default class CppParser implements ICodeParser { logicalLine.replace(/\*\//g, ""); } - if (endOfDeclaration) { + if (finalSlice >= 0) { return logicalLine.replace(/^\s+|\s+$/g, ""); } } |