From df3a5391f49dd3947354963dcf8a23e7ceec2b41 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sat, 20 Oct 2018 15:19:30 +0200 Subject: Parse python with # --- package.json | 2 +- src/CodeParserController.ts | 7 +++++-- src/Config.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cfa7e68..9229e4f 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "doxdocgen.python.triggerSequence": { "description": "Doxygen comment trigger. This character sequence triggers generation of Doxygen comments.", "type": "string", - "default": "\"\"\"" + "default": "##" }, "doxdocgen.file.fileTemplate": { "description": "The template for the file parameter in Doxygen.", diff --git a/src/CodeParserController.ts b/src/CodeParserController.ts index 1dfc5c4..4e38f06 100644 --- a/src/CodeParserController.ts +++ b/src/CodeParserController.ts @@ -80,12 +80,15 @@ export default class CodeParserController { // Do not trigger when there's whitespace after the trigger sequence // tslint:disable-next-line:max-line-length - const seq = "[\\s]*(" + this.cfg.C.triggerSequence.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + ")$"; + const seq = "[\\s]*([" + this.cfg.C.triggerSequence.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "]|[" + this.cfg.Python.triggerSequence.replace(/\#/g, "\\$&") + "])$"; const match: RegExpMatchArray = activeLine.text.match(seq); if (match !== null) { const cont: string = match[1]; - return this.cfg.C.triggerSequence === cont; + return ( + this.cfg.C.triggerSequence === cont || + cont === "#" // probably python + ); } else { return false; } diff --git a/src/Config.ts b/src/Config.ts index 55a22b5..58f3a43 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -31,7 +31,7 @@ class Python { return workspace.getConfiguration("doxdocgen.python"); } - public triggerSequence: string = '"""'; + public triggerSequence: string = "##"; } class File { -- cgit v1.2.3