summaryrefslogtreecommitdiffstats
path: root/src/Lang
diff options
context:
space:
mode:
Diffstat (limited to 'src/Lang')
-rw-r--r--src/Lang/Cpp/CppDocGen.ts21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts
index 2795ec6..bc9f09a 100644
--- a/src/Lang/Cpp/CppDocGen.ts
+++ b/src/Lang/Cpp/CppDocGen.ts
@@ -3,6 +3,7 @@ import * as moment from "moment";
import { Position, Range, Selection, TextEditor } from "vscode";
import { IDocGen } from "../../Common/IDocGen";
import { Config } from "../../Config";
+import GitConfig from "../../GitConfig";
import { CppArgument } from "./CppArgument";
import * as CppParser from "./CppParser";
import { CppToken, CppTokenType } from "./CppToken";
@@ -47,6 +48,8 @@ export class CppDocGen implements IDocGen {
protected vscodeAutoGeneratedComment: boolean;
+ private gitConfig;
+
/**
* @param {TextEditor} actEdit Active editor window
* @param {Position} cursorPosition Where the cursor of the user currently is
@@ -84,8 +87,9 @@ export class CppDocGen implements IDocGen {
/**
* @inheritdoc
*/
- public GenerateDoc(rangeToReplace: Range) {
+ public GenerateDoc(rangeToReplace: Range, gitConfig: GitConfig) {
let comment: string = "";
+ this.gitConfig = gitConfig;
if (this.commentType === CommentType.file) {
comment = this.generateFileDescription();
} else if (this.commentType === CommentType.method) {
@@ -291,13 +295,26 @@ export class CppDocGen implements IDocGen {
}
protected generateAuthorTag(lines: string[]) {
+ let authorName: string = this.cfg.Generic.authorName;
+ let authorEmail: string = this.cfg.Generic.authorEmail;
+
+ // Check if set to use the git username
+ if (this.cfg.Generic.useGitUserName === true) {
+ authorName = this.gitConfig.UserName;
+ }
+
+ // Check if set to use the git email
+ if (this.cfg.Generic.useGitUserEmail === true) {
+ authorEmail = this.gitConfig.UserEmail;
+ }
+
if (this.cfg.Generic.authorTag.trim().length !== 0) {
// Allow substitution of {author} and {email} only
lines.push(
...this.getMultiTemplatedString(
[this.cfg.authorTemplateReplace, this.cfg.emailTemplateReplace],
this.cfg.Generic.authorTag,
- [this.cfg.Generic.authorName, this.cfg.Generic.authorEmail],
+ [authorName, authorEmail],
).split("\n"),
);
}