From f1f1b62073a36df8e2e2f08fd343ebdaab77ed82 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Mon, 9 Oct 2017 21:15:00 +0200 Subject: Add option to choose Qt style comment start --- CHANGELOG.md | 4 ++++ README.md | 1 + package.json | 19 ++++++++++++++++++- src/CodeParser/CodeParserController.ts | 8 +++++--- src/Config.ts | 7 +++++++ 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/Config.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d661d3..29e872e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [0.0.3] + +- Add possibility to set comment start indicator to Qt style + ## [0.0.2] - Add C parser and generator diff --git a/README.md b/README.md index 5c6cdd7..5507a24 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Completely new extension, so none. * Suggest smart text * Configuration options + * Support more configuration options * Tests diff --git a/package.json b/package.json index 66e256c..a5d6658 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "doxdocgen", "displayName": "Doxygen Documentation Generator", "description": "Generate doxygen documentation from source code", - "version": "0.0.2", + "version": "0.0.3", "publisher": "cschlosser", "engines": { "vscode": "^1.16.0" @@ -13,6 +13,23 @@ "activationEvents": [ "onLanguage:cpp" ], + "contributes": { + "configuration": { + "type": "object", + "title": "Doxygen Documentation Generator Settings", + "properties": { + "doxdocgen.generic.commentStart": { + "description": "Doxygen comment start indicator. Default ist /** but Qt style with /*! is also valid.", + "type": "string", + "default": "/**", + "enum": [ + "/**", + "/*!" + ] + } + } + } + }, "icon": "images/icon.png", "keywords": [ "cpp", "c++", "c", "doxygen" diff --git a/src/CodeParser/CodeParserController.ts b/src/CodeParser/CodeParserController.ts index 7ed113e..49d4082 100644 --- a/src/CodeParser/CodeParserController.ts +++ b/src/CodeParser/CodeParserController.ts @@ -1,4 +1,5 @@ import { Disposable, Position, TextDocumentContentChangeEvent, TextEditor, TextLine, window, workspace } from "vscode"; +import { Config, ConfigType } from "../Config"; import CodeParser from "./CodeParser"; import CParser from "./CParser"; import CppParser from "./CppParser"; @@ -22,12 +23,12 @@ export default class CodeParserController { public constructor() { const subscriptions: Disposable[] = []; - this.readConfig(); - // Hand off the event to the parser if a valid parser is found workspace.onDidChangeTextDocument((event) => { const activeEditor: TextEditor = window.activeTextEditor; if (activeEditor && event.document === activeEditor.document) { + this.readConfig(); + this.onEvent(activeEditor, event.contentChanges[0]); } }, this, subscriptions); @@ -50,7 +51,8 @@ export default class CodeParserController { ***************************************************************************/ private readConfig() { - this.indicators.push("/**"); // TODO: make this customizable + this.indicators.pop(); + this.indicators.push(workspace.getConfiguration(ConfigType.generic).get(Config.commentStart, "/**")); } private check(activeEditor: TextEditor, event: TextDocumentContentChangeEvent): boolean { diff --git a/src/Config.ts b/src/Config.ts new file mode 100644 index 0000000..92d208c --- /dev/null +++ b/src/Config.ts @@ -0,0 +1,7 @@ +export enum ConfigType { + generic = "doxdocgen.generic", +} + +export enum Config { + commentStart = "commentStart", +} -- cgit v1.2.3