From 4ab08d85d42d00fe689d0119eed269ed98b226c8 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sat, 5 Oct 2019 12:33:36 +0200 Subject: Fix vscodeautocomplete detection --- src/Lang/Cpp/CppParser.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts index ca5edbb..35066fe 100644 --- a/src/Lang/Cpp/CppParser.ts +++ b/src/Lang/Cpp/CppParser.ts @@ -409,13 +409,13 @@ export default class CppParser implements ICodeParser { currentNest--; } else if (nextLineTxt[i] === "{" && currentNest === 0) { logicalLine += "\n" + nextLineTxt.slice(0, i); - return logicalLine.replace(/^\s+|\s+$/g, ""); + break; } else if ((nextLineTxt[i] === ";" || (nextLineTxt[i] === ":" && nextLineTxt[i - 1] !== ":" && nextLineTxt[i + 1] !== ":")) && currentNest === 0) { logicalLine += "\n" + nextLineTxt.slice(0, i); - return logicalLine.replace(/^\s+|\s+$/g, ""); + break; } } @@ -425,9 +425,12 @@ export default class CppParser implements ICodeParser { return ""; } - if (!this.isVsCodeAutoComplete(nextLineTxt)) { + if (this.isVsCodeAutoComplete(nextLineTxt)) { logicalLine += "\n" + nextLineTxt; + logicalLine.replace(/\*\//g, ""); } + + return logicalLine.trim(); } throw new Error("More than " + linesToGet + " lines were read from editor and no end of expression was found."); -- cgit v1.2.3