diff options
Diffstat (limited to 'src/CodeParserController.ts')
| -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) { |