summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2019-10-05 14:02:06 +0200
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2019-10-05 14:59:29 +0200
commite6388bf4711db2802d9cb8de5a2577b5dffafff3 (patch)
tree4757a40ca2df5129b03e06a0119ac00359683604
parentab10903637ceacb95fb47003ca512925b8d7faa3 (diff)
downloaddoxdocgen-e6388bf4711db2802d9cb8de5a2577b5dffafff3.tar.gz
Fix for real
-rw-r--r--src/Lang/Cpp/CppParser.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts
index 35f551c..0eb8a23 100644
--- a/src/Lang/Cpp/CppParser.ts
+++ b/src/Lang/Cpp/CppParser.ts
@@ -386,7 +386,7 @@ export default class CppParser implements ICodeParser {
let nextLineTxt: string = this.activeEditor.document.lineAt(nextLine.line).text.trim();
- // VSCode may enter a * on itself, we don"t want that in our method
+ // VSCode may enter a * on itself, we don't want that in our method
if (nextLineTxt === "*") {
nextLineTxt = "";
}
@@ -399,6 +399,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;
// Check if method has finished if curly brace is opened while
// nesting is occuring.
@@ -408,13 +409,12 @@ export default class CppParser implements ICodeParser {
} else if (nextLineTxt[i] === ")") {
currentNest--;
} else if (nextLineTxt[i] === "{" && currentNest === 0) {
- logicalLine += "\n" + nextLineTxt.slice(0, i);
+ finalSlice = i;
break;
} else if ((nextLineTxt[i] === ";"
|| (nextLineTxt[i] === ":" && nextLineTxt[i - 1] !== ":" && nextLineTxt[i + 1] !== ":"))
&& currentNest === 0) {
-
- logicalLine += "\n" + nextLineTxt.slice(0, i);
+ finalSlice = i;
break;
}
}
@@ -425,12 +425,19 @@ export default class CppParser implements ICodeParser {
return "";
}
- if (this.isVsCodeAutoComplete(nextLineTxt)) {
- logicalLine += "\n" + nextLineTxt;
+ if (!this.isVsCodeAutoComplete(nextLineTxt)) {
+ logicalLine += "\n";
+ if (finalSlice > 0) {
+ logicalLine += nextLineTxt.slice(0, finalSlice);
+ } else {
+ logicalLine += nextLineTxt;
+ }
logicalLine.replace(/\*\//g, "");
}
- return logicalLine.replace(/^\s+|\s+$/g, "");
+ if (finalSlice > 0) {
+ return logicalLine.replace(/^\s+|\s+$/g, "");
+ }
}
throw new Error("More than " + linesToGet + " lines were read from editor and no end of expression was found.");