diff options
| author | Christoph Schlosser <christoph@linux.com> | 2018-03-27 23:42:12 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christophschlosser@users.noreply.github.com> | 2018-03-30 00:09:58 +0200 |
| commit | 301cd45289f58b32819b217c34c49e7e09104afb (patch) | |
| tree | 9be64fb9b1b803739fc1d27646146bc4158595d1 | |
| parent | 6958e0d1f75314a48b55245a987e5397f8d7db7a (diff) | |
| download | doxdocgen-301cd45289f58b32819b217c34c49e7e09104afb.tar.gz | |
Don’t trigger if there’s whitespace after sequence
| -rw-r--r-- | src/CodeParserController.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/CodeParserController.ts b/src/CodeParserController.ts index 1084c46..6dfc263 100644 --- a/src/CodeParserController.ts +++ b/src/CodeParserController.ts @@ -70,9 +70,17 @@ export default class CodeParserController { return false; } - const cont: string = activeLine.text.trim(); + // 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 match: RegExpMatchArray = activeLine.text.match(seq); - return this.cfg.C.triggerSequence === cont; + if (match !== null) { + const cont: string = match[1]; + return this.cfg.C.triggerSequence === cont; + } else { + return false; + } } private onEvent(activeEditor: TextEditor, event: TextDocumentContentChangeEvent) { |