diff options
| author | Christoph Schlosser <christoph@linux.com> | 2018-10-20 14:57:16 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christoph@linux.com> | 2018-10-20 14:57:16 +0200 |
| commit | 049502aa73c7d43627b9856219b18bf0da98a255 (patch) | |
| tree | 87148438d5580b6580964f77eacf2a29cf14debe | |
| parent | c0df4b403b3d760f9a9bd72d0da4967858bc4c53 (diff) | |
| download | doxdocgen-049502aa73c7d43627b9856219b18bf0da98a255.tar.gz | |
Add basic Python files
| -rw-r--r-- | package.json | 5 | ||||
| -rw-r--r-- | src/CodeParserController.ts | 5 | ||||
| -rw-r--r-- | src/Config.ts | 12 | ||||
| -rw-r--r-- | src/Lang/Python/PythonDocGen.ts | 8 | ||||
| -rw-r--r-- | src/Lang/Python/PythonParser.ts | 17 |
5 files changed, 47 insertions, 0 deletions
diff --git a/package.json b/package.json index b8bf2e1..08f69a9 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,11 @@ "type": "string", "default": "Destroy the {name} object" }, + "doxdocgen.python.triggerSequence": { + "description": "Doxygen comment trigger. This character sequence triggers generation of Doxygen comments.", + "type": "string", + "default": "\"\"\"" + }, "doxdocgen.file.fileTemplate": { "description": "The template for the file parameter in Doxygen.", "type": "string", diff --git a/src/CodeParserController.ts b/src/CodeParserController.ts index 8be7034..1dfc5c4 100644 --- a/src/CodeParserController.ts +++ b/src/CodeParserController.ts @@ -11,6 +11,8 @@ import { import CodeParser from "./Common/ICodeParser"; import { Config } from "./Config"; import CppParser from "./Lang/Cpp/CppParser"; +import PythonParser from "./Lang/Python/PythonParser"; + /** * * Checks if the event matches the specified guidelines and if a parser exists for this language @@ -116,6 +118,9 @@ export default class CodeParserController { case "cpp": parser = new CppParser(this.cfg); break; + case "python": + parser = new PythonParser(this.cfg); + break; default: // tslint:disable-next-line:no-console console.log("No comments can be generated for language: " + lang); diff --git a/src/Config.ts b/src/Config.ts index b33aff2..55a22b5 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -26,6 +26,14 @@ class Cpp { public dtorText: string = "Destroy the {name} object"; } +class Python { + public static getConfiguration() { + return workspace.getConfiguration("doxdocgen.python"); + } + + public triggerSequence: string = '"""'; +} + class File { public static getConfiguration() { return workspace.getConfiguration("doxdocgen.file"); @@ -75,6 +83,8 @@ export class Config { values.Cpp.ctorText = Cpp.getConfiguration().get<string>("ctorText", values.Cpp.ctorText); values.Cpp.dtorText = Cpp.getConfiguration().get<string>("dtorText", values.Cpp.dtorText); + values.Python.triggerSequence = Python.getConfiguration().get<string>("triggerSequence", values.Python.triggerSequence); + values.File.fileTemplate = File.getConfiguration().get<string>("fileTemplate", values.File.fileTemplate); values.File.versionTag = File.getConfiguration().get<string>("versionTag", values.File.versionTag); values.File.copyrightTag = File.getConfiguration().get<string[]>("copyrightTag", values.File.copyrightTag); @@ -110,12 +120,14 @@ export class Config { public C: C; public Cpp: Cpp; + public Python: Python; public File: File; public Generic: Generic; constructor() { this.C = new C(); this.Cpp = new Cpp(); + this.Python = new Python(); this.File = new File(); this.Generic = new Generic(); } diff --git a/src/Lang/Python/PythonDocGen.ts b/src/Lang/Python/PythonDocGen.ts new file mode 100644 index 0000000..4b90f86 --- /dev/null +++ b/src/Lang/Python/PythonDocGen.ts @@ -0,0 +1,8 @@ +import { Range } from "vscode"; +import { IDocGen } from "../../Common/IDocGen"; + +export class PythonDocGen implements IDocGen { + public GenerateDoc(rangeToReplace: Range) { + throw new Error("Method not implemented."); + } +} diff --git a/src/Lang/Python/PythonParser.ts b/src/Lang/Python/PythonParser.ts new file mode 100644 index 0000000..2d26ed8 --- /dev/null +++ b/src/Lang/Python/PythonParser.ts @@ -0,0 +1,17 @@ +import { TextEditor } from "vscode"; +import ICodeParser from "../../Common/ICodeParser"; +import { IDocGen } from "../../Common/IDocGen"; +import { Config } from "../../Config"; + +export default class CppParser implements ICodeParser { + + protected readonly cfg: Config; + + constructor(cfg: Config) { + this.cfg = cfg; + } + + public Parse(activeEditor: TextEditor): IDocGen { + throw new Error("Method not implemented."); + } +} |