diff options
| author | Christoph Schlosser <2466365+cschlosser@users.noreply.github.com> | 2020-10-04 12:00:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-04 12:00:23 +0200 |
| commit | 2610f9e1beac36fe5065b92af97862f626e20a59 (patch) | |
| tree | 1083863134b7ede77df0887b3db130623a4c9472 /src | |
| parent | d82810b4ec7b2e13041479df7f751560d7e6be4f (diff) | |
| download | doxdocgen-2610f9e1beac36fe5065b92af97862f626e20a59.tar.gz | |
Release 0.8.1 (#178)0.8.1
* Revert "Add env-var to replace env var in template strings (#175)"
This reverts commit 28bd14d438affce02c87b7e7b108c3016feba6a4.
* Release 0.8.1
Revert env-var change
Diffstat (limited to 'src')
| -rw-r--r-- | src/Lang/Cpp/CppDocGen.ts | 36 | ||||
| -rw-r--r-- | src/extension.ts | 4 | ||||
| -rw-r--r-- | src/test/CppTests/Config.test.ts | 20 |
3 files changed, 8 insertions, 52 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts index 2795ec6..1e73804 100644 --- a/src/Lang/Cpp/CppDocGen.ts +++ b/src/Lang/Cpp/CppDocGen.ts @@ -1,10 +1,10 @@ -import * as env from "env-var"; import * as moment from "moment"; -import { Position, Range, Selection, TextEditor } from "vscode"; +import { Position, Range, Selection, TextEditor, TextLine, WorkspaceEdit } from "vscode"; import { IDocGen } from "../../Common/IDocGen"; import { Config } from "../../Config"; import { CppArgument } from "./CppArgument"; import * as CppParser from "./CppParser"; +import { CppParseTree } from "./CppParseTree"; import { CppToken, CppTokenType } from "./CppToken"; export enum SpecialCase { @@ -144,31 +144,9 @@ export class CppDocGen implements IDocGen { return indentedString; } - protected getEnvVars(replace: string): string { - let replacement = replace; - const regex = /\$\{env\:([\w|\d|_]+)\}/m; - let match: RegExpExecArray; - - // tslint:disable-next-line:no-conditional-assignment - while ((match = regex.exec(replacement)) !== null) { - if (match.index === regex.lastIndex) { - regex.lastIndex++; - } - - const m = match[1]; - - const envVar: string = env.get(m, m).asString(); - - replacement = replacement.replace("${env:" + m + "}", envVar); - } - - return replacement; - } - protected getTemplatedString(replace: string, template: string, param: string): string { const replacedTemplate = template.replace(replace, param); - const replacedWithEnv = this.getEnvVars(replacedTemplate); - return this.getIndentedTemplate(replacedWithEnv); + return this.getIndentedTemplate(replacedTemplate); } protected getMultiTemplatedString(replace: string[], template: string, param: string[]): string { @@ -178,7 +156,7 @@ export class CppDocGen implements IDocGen { template = template.replace(replace[i], param[i]); } } - return this.getEnvVars(template); + return template; } protected getSmartText(): string { @@ -475,15 +453,13 @@ export class CppDocGen implements IDocGen { lines, this.cfg.typeTemplateReplace, this.cfg.Generic.returnTemplate, - returnParams, + returnParams ); } break; } case "custom": { - this.cfg.Generic.customTags.forEach((elem) => { - lines.push(this.getEnvVars(elem)); - }); + lines.push(...this.cfg.Generic.customTags); break; } default: { diff --git a/src/extension.ts b/src/extension.ts index 9c80f73..05ba40a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,8 +5,8 @@ import * as vscode from "vscode"; import CodeParserController from "./CodeParserController"; enum Version { - CURRENT = "0.8.0", - PREVIOUS = "0.7.2", + CURRENT = "0.8.1", + PREVIOUS = "0.8.0", KEY = "doxdocgen_version", } diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts index d479d2d..3915f11 100644 --- a/src/test/CppTests/Config.test.ts +++ b/src/test/CppTests/Config.test.ts @@ -227,24 +227,4 @@ suite("C++ - Configuration Tests", () => { assert.equal("/**\n * @note\n */", result); }); - test("Env variable", () => { - testSetup.cfg = new Config(); - testSetup.cfg.Generic.order = ["custom"]; - if (process.platform === "win32") { - testSetup.cfg.Generic.customTags = ["@author ${env:USERNAME}"]; - const res = testSetup.SetLine("void foo();").GetResult(); - // USERNAME env var is different for everybody - assert.notEqual("/**\n * @author USERNAME\n */", res); - } else { - testSetup.cfg.Generic.customTags = ["@author ${env:USER}"]; - const res = testSetup.SetLine("void foo();").GetResult(); - // USER env var is different for everybody - assert.notEqual("/**\n * @author USER\n */", res); - } - - testSetup.cfg.Generic.customTags = ["@author ${env:MY_VARIABLE}"]; - const result = testSetup.SetLine("void foo();").GetResult(); - assert.equal("/**\n * @author MY_VARIABLE\n */", result); - }); - }); |