summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2018-03-02 23:24:50 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-03-02 23:47:28 +0100
commitaeb67cd13dcf5e5b69898dff6c05c605a81827f4 (patch)
tree1e5809b1f9957b02cb7f3d54ad4c5a95cb502e0e
parent8701d74ba4672c0d916fc01f950f5a7cc1298881 (diff)
downloaddoxdocgen-aeb67cd13dcf5e5b69898dff6c05c605a81827f4.tar.gz
Add brief template
-rw-r--r--package.json2
-rw-r--r--src/Config.ts3
-rw-r--r--src/Lang/Cpp/CppDocGen.ts8
3 files changed, 7 insertions, 6 deletions
diff --git a/package.json b/package.json
index 1b89a55..3b4410a 100644
--- a/package.json
+++ b/package.json
@@ -109,7 +109,7 @@
"doxdocgen.generic.briefTemplate": {
"description": "The template of the brief DoxyGen line that is generated. If empty it won't get generated at all.",
"type": "string",
- "default": "@brief "
+ "default": "@brief {text}"
},
"doxdocgen.generic.paramTemplate": {
"description": "The template of the param DoxyGen line(s) that are generated. If empty it won't get generated at all.",
diff --git a/src/Config.ts b/src/Config.ts
index 0fcd5a2..a0bae83 100644
--- a/src/Config.ts
+++ b/src/Config.ts
@@ -42,7 +42,7 @@ class Generic {
public includeTypeAtReturn: boolean = true;
public boolReturnsTrueFalse: boolean = true;
- public briefTemplate: string = "@brief ";
+ public briefTemplate: string = "@brief {text}";
public paramTemplate: string = "@param {param} ";
public returnTemplate: string = "@return {type} ";
public linesToGet: number = 20;
@@ -93,6 +93,7 @@ export class Config {
public readonly typeTemplateReplace: string = "{type}";
public readonly nameTemplateReplace: string = "{name}";
public readonly dateTemplateReplace: string = "{date}";
+ public readonly textTemplateReplace: string = "{text}";
public C: C;
public Cpp: Cpp;
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts
index 56ce922..dd4818a 100644
--- a/src/Lang/Cpp/CppDocGen.ts
+++ b/src/Lang/Cpp/CppDocGen.ts
@@ -162,7 +162,9 @@ export class CppDocGen implements IDocGen {
}
protected generateBrief(lines: string[]) {
- lines.push(this.cfg.C.commentPrefix + this.cfg.Generic.briefTemplate + this.getSmartText());
+ lines.push(this.getTemplatedString(this.cfg.textTemplateReplace,
+ this.cfg.C.commentPrefix + this.cfg.Generic.briefTemplate,
+ this.getSmartText()));
}
protected generateFromTemplate(lines: string[], replace: string, template: string, templateWith: string[]) {
@@ -365,10 +367,8 @@ export class CppDocGen implements IDocGen {
line = baseLine;
character = baseCharacter;
}
- const start = character - this.smartTextLength - 1;
- const from: Position = new Position(line, (start > 0 ? start : 0));
const to: Position = new Position(line, character);
- this.activeEditor.selection = new Selection(from, to);
+ this.activeEditor.selection = new Selection(to, to);
}
protected splitCasing(text: string): string {