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 --- src/CodeParser/CodeParserController.ts | 8 +++++--- src/Config.ts | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/Config.ts (limited to 'src') 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