diff options
| author | HO-COOH <42881734+HO-COOH@users.noreply.github.com> | 2021-05-15 00:14:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-14 18:14:36 +0200 |
| commit | af70cf95d9d010f27da1c1c8987c807ee3255a10 (patch) | |
| tree | 9d6de559ea072c684f690d32816f7fe3ae1a88d3 /src/CodeParserController.ts | |
| parent | be07386c572fe8258a3b4c101b85dd900867bb13 (diff) | |
| download | doxdocgen-af70cf95d9d010f27da1c1c8987c807ee3255a10.tar.gz | |
Refactor, add {file} template (#221)
* Refactor, add {file} template
* Add test for {file} expansion
Diffstat (limited to 'src/CodeParserController.ts')
| -rw-r--r-- | src/CodeParserController.ts | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/CodeParserController.ts b/src/CodeParserController.ts index f87e221..3b6348a 100644 --- a/src/CodeParserController.ts +++ b/src/CodeParserController.ts @@ -12,6 +12,7 @@ import CodeParser from "./Common/ICodeParser"; import { Config } from "./Config"; import GitConfig from "./GitConfig"; import CppParser from "./Lang/Cpp/CppParser"; +import { inComment } from "./util"; /** * * Checks if the event matches the specified guidelines and if a parser exists for this language @@ -75,7 +76,7 @@ export default class CodeParserController { } // Check if currently in a comment block - if (this.inComment(activeEditor, activeSelection.line)) { + if (inComment(activeEditor, activeSelection.line)) { return false; } @@ -92,20 +93,6 @@ export default class CodeParserController { } } - private inComment(activeEditor: TextEditor, activeLine: number): boolean { - if (activeLine === 0) { - return false; - } - - const txt: string = activeEditor.document.lineAt(activeLine - 1).text.trim(); - if (!txt.startsWith("///") && !txt.startsWith("*") && - !txt.startsWith("/**") && !txt.startsWith("/*!")) { - return false; - } else { - return true; - } - } - private onEvent(activeEditor: TextEditor, event: TextDocumentContentChangeEvent) { if (!this.check(activeEditor, event)) { return null; |