summaryrefslogtreecommitdiffstats
path: root/src/Config.ts
diff options
context:
space:
mode:
authorRowan Goemans <RB.Goemans@student.han.nl>2017-12-31 02:03:08 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-02-20 22:02:22 +0100
commit1746f21bc3720585d2fe877db8d69aae301ff02c (patch)
tree7f0d081fd8fc3e0b54c7bb478cb8724a4cf3b798 /src/Config.ts
parentb446b9e596fc0487b88597d8e818dae61512f309 (diff)
downloaddoxdocgen-1746f21bc3720585d2fe877db8d69aae301ff02c.tar.gz
-- Added many unit tests for the C parser. Almost complete now
-- Refactored project structure to allow for more overview once we add more languages. -- Renamed a lot of types in the CParser to be more explicit. -- Made configuration injectable into the classes that need them. This allows to unit test configuration variables. -- Added 2 new config params that allows to customize what gets returned for a bool return type. -- Small changes to the logic to make it more concise.
Diffstat (limited to 'src/Config.ts')
-rw-r--r--src/Config.ts57
1 files changed, 41 insertions, 16 deletions
diff --git a/src/Config.ts b/src/Config.ts
index 3cc78fb..6297a66 100644
--- a/src/Config.ts
+++ b/src/Config.ts
@@ -1,18 +1,43 @@
-export enum ConfigType {
- generic = "doxdocgen.generic",
-}
+import { workspace } from "vscode";
+
+export class Config {
+ public static ImportFromSettings(): Config {
+ const values: Config = new Config();
+
+ const cfg = workspace.getConfiguration("doxdocgen.generic");
+
+ values.firstLine = cfg.get<string>("firstLine", values.firstLine);
+ values.commentPrefix = cfg.get<string>("commentPrefix", values.commentPrefix);
+ values.lastLine = cfg.get<string>("lastLine", values.lastLine);
+ values.newLineAfterBrief = cfg.get<boolean>("newLineAfterBrief", values.newLineAfterBrief);
+ values.newLineAfterParams = cfg.get<boolean>("newLineAfterParams", values.newLineAfterParams);
+ values.newLineAfterTParams = cfg.get<boolean>("newLineAfterTParams", values.newLineAfterTParams);
+ values.includeTypeAtReturn = cfg.get<boolean>("includeTypeAtReturn", values.includeTypeAtReturn);
+ values.boolReturnsTrueFalse = cfg.get<boolean>("boolReturnsTrueFalse", values.boolReturnsTrueFalse);
+ values.boolPointerReturnsNull = cfg.get<boolean>("boolPointerReturnsNull", values.boolPointerReturnsNull);
+ values.briefTemplate = cfg.get<string>("briefTemplate", values.briefTemplate);
+ values.paramTemplate = cfg.get<string>("paramTemplate", values.paramTemplate);
+ values.tparamTemplate = cfg.get<string>("tparamTemplate", values.tparamTemplate);
+ values.returnTemplate = cfg.get<string>("returnTemplate", values.returnTemplate);
+
+ return values;
+ }
+
+ public readonly paramTemplateReplace: string = "{param}";
+ public readonly typeTemplateReplace: string = "{type}";
-export enum Config {
- triggerSequence = "triggerSequence",
- firstLine = "firstLine",
- commentPrefix = "commentPrefix",
- lastLine = "lastLine",
- newLineAfterBrief = "newLineAfterBrief",
- newLineAfterParams = "newLineAfterParams",
- newLineAfterTParams = "newLineAfterTParams",
- includeTypeAtReturn = "includeTypeAtReturn",
- briefTemplate = "briefTemplate",
- paramTemplate = "paramTemplate",
- tparamTemplate = "tparamTemplate",
- returnTemplate = "returnTemplate",
+ public triggerSequence: string = "/**";
+ public firstLine: string = "/**";
+ public commentPrefix: string = " * ";
+ public lastLine: string = " */";
+ public newLineAfterBrief: boolean = true;
+ public newLineAfterParams: boolean = false;
+ public newLineAfterTParams: boolean = false;
+ public includeTypeAtReturn: boolean = true;
+ public boolReturnsTrueFalse: boolean = true;
+ public boolPointerReturnsNull: boolean = true;
+ public briefTemplate: string = "@brief ";
+ public paramTemplate: string = "@param {param} ";
+ public tparamTemplate: string = "@tparam {param} ";
+ public returnTemplate: string = "@return {type} ";
}