summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--.travis.yml23
-rw-r--r--.vscode/launch.json28
-rw-r--r--.vscode/settings.json9
-rw-r--r--.vscode/tasks.json20
-rw-r--r--CHANGELOG.md5
-rw-r--r--README.md12
-rw-r--r--appveyor.yml4
-rw-r--r--package.json2
-rw-r--r--src/CodeParser/CParser.ts131
-rw-r--r--src/CodeParser/CodeParserController.ts4
-rw-r--r--src/CodeParser/CppParser.ts123
-rw-r--r--src/DocGen/CGen.ts153
-rw-r--r--src/DocGen/CppGen.ts153
14 files changed, 395 insertions, 274 deletions
diff --git a/.gitignore b/.gitignore
index 8c8220a..5fe00fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
out
node_modules
.vscode-test/
-.vsix
+*.vsix
diff --git a/.travis.yml b/.travis.yml
index 760e13c..9d1eb9a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,9 @@
sudo: false
+branches:
+ only:
+ - master
+
os:
- linux
- osx
@@ -20,6 +24,7 @@ stages:
- lint
- build
- test
+ - release
before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
@@ -36,4 +41,20 @@ jobs:
- stage: lint
script: tslint -c tslint.json 'src/**/*.ts'
- stage: build
- script: npm run vscode:prepublish \ No newline at end of file
+ script: npm run vscode:prepublish
+ - stage: release
+ script:
+ - npm install vsce
+ - vsce package
+ deploy:
+ - provider: releases
+ api_key: $GITHUB_OAUTH_TOKEN
+ file: "./doxdocgen-$TRAVIS_TAG.vsix"
+ skip_cleanup: true
+ on:
+ tags: true
+ - provider: script
+ script: vsce publish -p $VSMARKETPLACE_ACCESS_TOKEN
+ skip_cleanup: true
+ on:
+ tags: true \ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..3333439
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,28 @@
+// A launch configuration that compiles the extension and then opens it inside a new window
+{
+ "version": "0.1.0",
+ "configurations": [
+ {
+ "name": "Launch Extension",
+ "type": "extensionHost",
+ "request": "launch",
+ "runtimeExecutable": "${execPath}",
+ "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
+ "stopOnEntry": false,
+ "sourceMaps": true,
+ "outFiles": [ "${workspaceRoot}/out/**/*.js" ],
+ "preLaunchTask": "npm: watch"
+ },
+ {
+ "name": "Launch Tests",
+ "type": "extensionHost",
+ "request": "launch",
+ "runtimeExecutable": "${execPath}",
+ "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
+ "stopOnEntry": false,
+ "sourceMaps": true,
+ "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
+ "preLaunchTask": "npm: watch"
+ }
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..d137133
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,9 @@
+// Place your settings in this file to overwrite default and user settings.
+{
+ "files.exclude": {
+ "out": false // set this to true to hide the "out" folder with the compiled JS files
+ },
+ "search.exclude": {
+ "out": true // set this to false to include "out" folder in search results
+ }
+} \ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..604e38f
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,20 @@
+// See https://go.microsoft.com/fwlink/?LinkId=733558
+// for the documentation about the tasks.json format
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "type": "npm",
+ "script": "watch",
+ "problemMatcher": "$tsc-watch",
+ "isBackground": true,
+ "presentation": {
+ "reveal": "never"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98a3e86..9d661d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
# Change Log
+## [0.0.2]
+
+- Add C parser and generator
+
## [0.0.1]
+
- Initial release \ No newline at end of file
diff --git a/README.md b/README.md
index ac36005..bb7d0db 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Generate Doxygen Comments fro VSCode
+# Generate Doxygen Comments for VS Code
-This VSCode Extensions provides Doxygen Documentation generation on the fly by starting a Doxygen comment block and pressing enter.
+This VS Code Extensions provides Doxygen Documentation generation on the fly by starting a Doxygen comment block and pressing enter.
[![Build Status](https://travis-ci.org/christophschlosser/doxdocgen.svg?branch=master)](https://travis-ci.org/christophschlosser/doxdocgen)
[![Build status](https://ci.appveyor.com/api/projects/status/4h84071p9tv0y9r6?svg=true)](https://ci.appveyor.com/project/christophschlosser/doxdocgen)
@@ -54,3 +54,11 @@ Completely new extension, so none.
* Configuration options
* Tests
+
+* More languages
+ * C
+
+* Improve language support
+ * Classes
+ * Namespaces
+ * Enums
diff --git a/appveyor.yml b/appveyor.yml
index a52d318..7aa2b48 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,6 +3,10 @@ environment:
VSCODE_BUILD_VERBOSE: true
nodejs_version: "6"
+branches:
+ only:
+ - master
+
image: Visual Studio 2015
install:
diff --git a/package.json b/package.json
index a4c444a..e6acbb4 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.1",
+ "version": "0.0.2",
"publisher": "cschlosser",
"engines": {
"vscode": "^1.16.0"
diff --git a/src/CodeParser/CParser.ts b/src/CodeParser/CParser.ts
new file mode 100644
index 0000000..09fd5da
--- /dev/null
+++ b/src/CodeParser/CParser.ts
@@ -0,0 +1,131 @@
+import { Position, TextDocumentContentChangeEvent, TextEditor, TextLine } from "vscode";
+import Generator from "../DocGen/CGen";
+import { IDocGen } from "../DocGen/DocGen";
+import ICodeParser from "./CodeParser";
+
+/**
+ *
+ * Parses C code for methods and signatures
+ *
+ * @export
+ * @class CParser
+ * @implements {ICodeParser}
+ */
+export default class CParser implements ICodeParser {
+ protected activeEditor: TextEditor;
+ protected activeSelection: Position;
+
+ /**
+ * @inheritdoc
+ */
+ public Parse(activeEdit: TextEditor, event: TextDocumentContentChangeEvent): IDocGen {
+ this.activeEditor = activeEdit;
+ this.activeSelection = this.activeEditor.selection.active;
+
+ const activeLine: TextLine = this.activeEditor.document.lineAt(this.activeEditor.selection.active.line);
+
+ const method: string = this.getMethodText();
+
+ // Not a method
+ if (method.length === 0) {
+ return null;
+ }
+
+ const returnValue: string[] = this.getReturn(method);
+
+ const params: string[] = this.getParams(method);
+
+ const cppGenerator: IDocGen = new Generator(this.activeEditor, this.activeSelection, params, returnValue);
+ return cppGenerator;
+ }
+
+ /***************************************************************************
+ Implementation
+ ***************************************************************************/
+
+ protected getMethodText(): string {
+ let method: string = "";
+
+ let nextLine: Position = new Position(this.activeSelection.line + 1, this.activeSelection.character);
+
+ let nextLineTxt: string = this.activeEditor.document.lineAt(nextLine.line).text.trim();
+
+ // VSCode may enter a * on itself, we don't want that in our method
+ if (nextLineTxt === "*") {
+ nextLineTxt = "";
+ }
+
+ while (nextLineTxt.length === 0) { // Get first method line
+ nextLine = new Position(nextLine.line + 1, nextLine.character);
+ nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim();
+ }
+
+ method += nextLineTxt;
+
+ // Get method end line
+ while (nextLineTxt.indexOf(")") === -1 &&
+ (nextLineTxt.indexOf(";") === -1 || nextLineTxt.indexOf("}") === -1)) { // Check for method end
+ nextLine = new Position(nextLine.line + 1, nextLine.character);
+ nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim();
+
+ method += " " + nextLineTxt;
+ }
+
+ // Not a method but some code in the file
+ if (method.indexOf(")") === -1) {
+ return "";
+ }
+
+ return method;
+ }
+
+ protected getReturn(method: string): string[] {
+ const retVals: string[] = [];
+
+ // Remove the parameters from the signature
+ const returnSignature: string = method.slice(0, method.indexOf("(")).trim();
+
+ if (returnSignature.indexOf(" ") === -1) { // Constructor or similar
+ return retVals;
+ }
+
+ const returnType: string = returnSignature.substr(0, returnSignature.lastIndexOf(" "));
+
+ switch (returnType) {
+ case "bool":
+ retVals.push("true");
+ retVals.push("false");
+ break;
+ case "void":
+ break;
+ default:
+ retVals.push(returnType);
+ break;
+ }
+
+ return retVals;
+ }
+
+ protected getParams(method: string): string[] {
+ const params: string[] = [];
+
+ // Get parameters from enclosing brackets
+ const parameters: string = method.slice(method.indexOf("(")) // Get opening bracket
+ .slice(1, method.indexOf(")")) // Remove opening bracket
+ .split(")")[0]; // Get closing bracket
+
+ if (parameters.length === 0) { // No parameters
+ return params;
+ }
+
+ let paramArr: string[] = parameters.split(",");
+ paramArr = paramArr.map((item: string) => {
+ // Remove any special C++ characters
+ const clean: string = item.trim().replace(/[&*\[\]]/g, "");
+
+ return clean.split(" ").pop();
+ });
+
+ return paramArr;
+ }
+}
diff --git a/src/CodeParser/CodeParserController.ts b/src/CodeParser/CodeParserController.ts
index 6583cde..7ed113e 100644
--- a/src/CodeParser/CodeParserController.ts
+++ b/src/CodeParser/CodeParserController.ts
@@ -1,5 +1,6 @@
import { Disposable, Position, TextDocumentContentChangeEvent, TextEditor, TextLine, window, workspace } from "vscode";
import CodeParser from "./CodeParser";
+import CParser from "./CParser";
import CppParser from "./CppParser";
/**
@@ -88,6 +89,9 @@ export default class CodeParserController {
let parser: CodeParser;
switch (lang) {
+ case "c":
+ parser = new CParser();
+ break;
case "cpp":
parser = new CppParser();
break;
diff --git a/src/CodeParser/CppParser.ts b/src/CodeParser/CppParser.ts
index e194371..2d5985b 100644
--- a/src/CodeParser/CppParser.ts
+++ b/src/CodeParser/CppParser.ts
@@ -1,7 +1,7 @@
import { Position, TextDocumentContentChangeEvent, TextEditor, TextLine } from "vscode";
-import CppGenerator from "../DocGen/CppGen";
+import Generator from "../DocGen/CGen";
import { IDocGen } from "../DocGen/DocGen";
-import ICodeParser from "./CodeParser";
+import CParser from "./CParser";
/**
*
@@ -11,121 +11,6 @@ import ICodeParser from "./CodeParser";
* @class CppParser
* @implements {ICodeParser}
*/
-export default class CppParser implements ICodeParser {
- private activeEditor: TextEditor;
- private activeSelection: Position;
-
- /**
- * @inheritdoc
- */
- public Parse(activeEdit: TextEditor, event: TextDocumentContentChangeEvent): IDocGen {
- this.activeEditor = activeEdit;
- this.activeSelection = this.activeEditor.selection.active;
-
- const activeLine: TextLine = this.activeEditor.document.lineAt(this.activeEditor.selection.active.line);
-
- const method: string = this.getMethodText();
-
- // Not a method
- if (method.length === 0) {
- return null;
- }
-
- const returnValue: string[] = this.getReturn(method);
-
- const params: string[] = this.getParams(method);
-
- const cppGenerator: IDocGen = new CppGenerator(this.activeEditor, this.activeSelection, params, returnValue);
- return cppGenerator;
- }
-
- /***************************************************************************
- Implementation
- ***************************************************************************/
-
- private getMethodText(): string {
- let method: string = "";
-
- let nextLine: Position = new Position(this.activeSelection.line + 1, this.activeSelection.character);
-
- let nextLineTxt: string = this.activeEditor.document.lineAt(nextLine.line).text.trim();
-
- // VSCode may enter a * on itself, we don't want that in our method
- if (nextLineTxt === "*") {
- nextLineTxt = "";
- }
-
- while (nextLineTxt.length === 0) { // Get first method line
- nextLine = new Position(nextLine.line + 1, nextLine.character);
- nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim();
- }
-
- method += nextLineTxt;
-
- // Get method end line
- while (nextLineTxt.indexOf(")") === -1 &&
- (nextLineTxt.indexOf(";") === -1 || nextLineTxt.indexOf("}") === -1)) { // Check for method end
- nextLine = new Position(nextLine.line + 1, nextLine.character);
- nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim();
-
- method += " " + nextLineTxt;
- }
-
- // Not a method but some code in the file
- if (method.indexOf(")") === -1) {
- return "";
- }
-
- return method;
- }
-
- private getReturn(method: string): string[] {
- const retVals: string[] = [];
-
- // Remove the parameters from the signature
- const returnSignature: string = method.slice(0, method.indexOf("(")).trim();
-
- if (returnSignature.indexOf(" ") === -1) { // Constructor or similar
- return retVals;
- }
-
- const returnType: string = returnSignature.substr(0, returnSignature.lastIndexOf(" "));
-
- switch (returnType) {
- case "bool":
- retVals.push("true");
- retVals.push("false");
- break;
- case "void":
- break;
- default:
- retVals.push(returnType);
- break;
- }
-
- return retVals;
- }
-
- private getParams(method: string): string[] {
- const params: string[] = [];
-
- // Get parameters from enclosing brackets
- const parameters: string = method.slice(method.indexOf("(")) // Get opening bracket
- .slice(1, method.indexOf(")")) // Remove opening bracket
- .split(")")[0]; // Get closing bracket
-
- if (parameters.length === 0) { // No parameters
- return params;
- }
-
- let paramArr: string[] = parameters.split(",");
- paramArr = paramArr.map((item: string) => {
- // Remove any special C++ characters
- const clean: string = item.trim().replace(/[&*\[\]]/g, "");
-
- return clean.split(" ").pop();
- });
-
- return paramArr;
- }
+export default class CppParser extends CParser {
+ // For now C++ is the same as C
}
diff --git a/src/DocGen/CGen.ts b/src/DocGen/CGen.ts
new file mode 100644
index 0000000..5a80ee0
--- /dev/null
+++ b/src/DocGen/CGen.ts
@@ -0,0 +1,153 @@
+import { Position, Range, Selection, TextEditor, TextLine, WorkspaceEdit } from "vscode";
+import { DoxygenCommands, IDocGen } from "./DocGen";
+
+export default class CGen implements IDocGen {
+ protected lineStart: string;
+ protected endComment: string;
+ protected commandIndicator: string;
+ protected spaceAfterCommand: string;
+ protected activeEditor: TextEditor;
+ protected position: Position;
+ protected comment: string;
+ protected retVals: string[];
+ protected params: string[];
+
+ /**
+ * @param {TextEditor} actEdit Active editor window
+ * @param {Position} cursorPosition Where the cursor of the user currently is
+ * @param {string[]} param The parameter names of the method extracted by the parser
+ * @param {string[]} returnVals The return values extracted by the parser
+ */
+ public constructor(actEdit: TextEditor, cursorPosition: Position, param: string[], returnVals: string[]) {
+ this.activeEditor = actEdit;
+ this.position = cursorPosition;
+ this.comment = "\n"; // Add the new line after the comment indicator
+ this.params = param;
+ this.retVals = returnVals;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public GenerateDoc() {
+ this.readConfig();
+ this.generateComment();
+
+ const oldPos: Position = this.position;
+
+ const active: Position = this.activeEditor.selection.active;
+ const anchor: Position = new Position(active.line + 1, active.character); // Start at the next line
+ const replaceSelection = new Selection(anchor, active);
+ this.activeEditor.edit((editBuilder) => {
+ editBuilder.replace(replaceSelection, this.comment); // Insert the comment
+ });
+
+ // Set cursor after brief command
+ this.setCursor(oldPos.line + 3, oldPos.character);
+ const newSelectActive = new Position(oldPos.line + 3, oldPos.character + DoxygenCommands.detailed.length);
+ const newSelectPos = new Position(oldPos.line + 3, oldPos.character);
+ this.activeEditor.selection = new Selection(newSelectPos, newSelectActive);
+ }
+
+ /***************************************************************************
+ Implementation
+ ***************************************************************************/
+
+ protected readConfig() {
+ this.lineStart = " * "; // TODO: make this customizable
+ this.endComment = "*/"; // TODO: make this customizable
+ this.commandIndicator = "@"; // TODO: make this customizable
+ this.spaceAfterCommand = " "; // TODO: make this customizable
+ }
+
+ protected indentLine(commentLine: string): string {
+ const line: TextLine = this.activeEditor.document.lineAt(this.activeEditor.selection.start.line);
+ const lineTxt: string = line.text;
+ let stringToIndent: string = "";
+ // Find indentation from previous line
+ for (let i = 0; i < line.firstNonWhitespaceCharacterIndex; i++) {
+ if (lineTxt.charAt(i) === "\t") {
+ stringToIndent = stringToIndent + "\t";
+ } else if (lineTxt.charAt(i) === " ") {
+ stringToIndent = stringToIndent + " ";
+ }
+ }
+ const textToInsert = stringToIndent + commentLine;
+ return textToInsert;
+ }
+
+ protected generateBrief() {
+ let line: string = "";
+ line += this.lineStart;
+ line += this.commandIndicator;
+ line += DoxygenCommands.brief;
+ line += this.spaceAfterCommand;
+ this.comment += this.indentLine(line);
+ }
+
+ protected generateDetailed() {
+ let line: string = "";
+ line += this.lineStart;
+ line += "\n";
+ this.comment += this.indentLine(line);
+ line = this.lineStart;
+ line += DoxygenCommands.detailed + "\n";
+ this.comment += this.indentLine(line);
+ line = this.lineStart;
+ this.comment += this.indentLine(line);
+ }
+
+ protected generateParams() {
+ let line: string = "";
+
+ this.params.forEach((element: string) => {
+ line = this.lineStart;
+ line += this.commandIndicator;
+ line += DoxygenCommands.param + " "; // TODO: Make this customizable
+ line += element + "\n";
+ this.comment += this.indentLine(line);
+ });
+ }
+
+ protected generateReturn() {
+ let line: string = "";
+
+ this.retVals.forEach((element: string) => {
+ line = this.lineStart;
+ line += this.commandIndicator;
+ line += DoxygenCommands.return + " "; // TODO: Make this customizable
+ line += element + "\n";
+ this.comment += this.indentLine(line);
+ });
+ }
+
+ protected generateEnd() {
+ let line: string = " "; // TODO: Make this customizable
+ line += this.endComment;
+ this.comment += this.indentLine(line);
+ }
+
+ protected generateComment() {
+ this.generateBrief();
+ this.comment += "\n";
+ this.generateDetailed();
+ this.comment += "\n";
+ if (this.params.length !== 0) { // Only if we have parameters
+ this.generateParams();
+ }
+ if (this.retVals.length !== 0) { // Only if we have return values
+ if (this.params.length !== 0) {
+ const line: string = this.lineStart + "\n";
+ this.comment += this.indentLine(line);
+ }
+ this.generateReturn();
+ }
+ this.generateEnd();
+ }
+
+ protected setCursor(line: number, character: number) {
+ const indentLen: number = this.indentLine("").length;
+ const move: Selection = new Selection(line, character, line, character);
+ this.activeEditor.selection = move;
+ }
+}
diff --git a/src/DocGen/CppGen.ts b/src/DocGen/CppGen.ts
index 1dc70f7..c13d194 100644
--- a/src/DocGen/CppGen.ts
+++ b/src/DocGen/CppGen.ts
@@ -1,153 +1,6 @@
import { Position, Range, Selection, TextEditor, TextLine, WorkspaceEdit } from "vscode";
-import { DoxygenCommands, IDocGen } from "./DocGen";
+import CGen from "./CGen";
-export default class CppGen implements IDocGen {
- private lineStart: string;
- private endComment: string;
- private commandIndicator: string;
- private spaceAfterCommand: string;
- private activeEditor: TextEditor;
- private position: Position;
- private comment: string;
- private retVals: string[];
- private params: string[];
-
- /**
- * @param {TextEditor} actEdit Active editor window
- * @param {Position} cursorPosition Where the cursor of the user currently is
- * @param {string[]} param The parameter names of the method extracted by the parser
- * @param {string[]} returnVals The return values extracted by the parser
- */
- public constructor(actEdit: TextEditor, cursorPosition: Position, param: string[], returnVals: string[]) {
- this.activeEditor = actEdit;
- this.position = cursorPosition;
- this.comment = "\n"; // Add the new line after the comment indicator
- this.params = param;
- this.retVals = returnVals;
- }
-
- /**
- * @inheritdoc
- */
- public GenerateDoc() {
- this.readConfig();
- this.generateComment();
-
- const oldPos: Position = this.position;
-
- const active: Position = this.activeEditor.selection.active;
- const anchor: Position = new Position(active.line + 1, active.character); // Start at the next line
- const replaceSelection = new Selection(anchor, active);
- this.activeEditor.edit((editBuilder) => {
- editBuilder.replace(replaceSelection, this.comment); // Insert the comment
- });
-
- // Set cursor after brief command
- this.setCursor(oldPos.line + 3, oldPos.character);
- const newSelectActive = new Position(oldPos.line + 3, oldPos.character + DoxygenCommands.detailed.length);
- const newSelectPos = new Position(oldPos.line + 3, oldPos.character);
- this.activeEditor.selection = new Selection(newSelectPos, newSelectActive);
- }
-
- /***************************************************************************
- Implementation
- ***************************************************************************/
-
- private readConfig() {
- this.lineStart = " * "; // TODO: make this customizable
- this.endComment = "*/"; // TODO: make this customizable
- this.commandIndicator = "@"; // TODO: make this customizable
- this.spaceAfterCommand = " "; // TODO: make this customizable
- }
-
- private indentLine(commentLine: string): string {
- const line: TextLine = this.activeEditor.document.lineAt(this.activeEditor.selection.start.line);
- const lineTxt: string = line.text;
- let stringToIndent: string = "";
- // Find indentation from previous line
- for (let i = 0; i < line.firstNonWhitespaceCharacterIndex; i++) {
- if (lineTxt.charAt(i) === "\t") {
- stringToIndent = stringToIndent + "\t";
- } else if (lineTxt.charAt(i) === " ") {
- stringToIndent = stringToIndent + " ";
- }
- }
- const textToInsert = stringToIndent + commentLine;
- return textToInsert;
- }
-
- private generateBrief() {
- let line: string = "";
- line += this.lineStart;
- line += this.commandIndicator;
- line += DoxygenCommands.brief;
- line += this.spaceAfterCommand;
- this.comment += this.indentLine(line);
- }
-
- private generateDetailed() {
- let line: string = "";
- line += this.lineStart;
- line += "\n";
- this.comment += this.indentLine(line);
- line = this.lineStart;
- line += DoxygenCommands.detailed + "\n";
- this.comment += this.indentLine(line);
- line = this.lineStart;
- this.comment += this.indentLine(line);
- }
-
- private generateParams() {
- let line: string = "";
-
- this.params.forEach((element: string) => {
- line = this.lineStart;
- line += this.commandIndicator;
- line += DoxygenCommands.param + " "; // TODO: Make this customizable
- line += element + "\n";
- this.comment += this.indentLine(line);
- });
- }
-
- private generateReturn() {
- let line: string = "";
-
- this.retVals.forEach((element: string) => {
- line = this.lineStart;
- line += this.commandIndicator;
- line += DoxygenCommands.return + " "; // TODO: Make this customizable
- line += element + "\n";
- this.comment += this.indentLine(line);
- });
- }
-
- private generateEnd() {
- let line: string = " "; // TODO: Make this customizable
- line += this.endComment;
- this.comment += this.indentLine(line);
- }
-
- private generateComment() {
- this.generateBrief();
- this.comment += "\n";
- this.generateDetailed();
- this.comment += "\n";
- if (this.params.length !== 0) { // Only if we have parameters
- this.generateParams();
- }
- if (this.retVals.length !== 0) { // Only if we have return values
- if (this.params.length !== 0) {
- const line: string = this.lineStart + "\n";
- this.comment += this.indentLine(line);
- }
- this.generateReturn();
- }
- this.generateEnd();
- }
-
- private setCursor(line: number, character: number) {
- const indentLen: number = this.indentLine("").length;
- const move: Selection = new Selection(line, character, line, character);
- this.activeEditor.selection = move;
- }
+export default class CppGen extends CGen {
+ // For now C++ is the same as C
}