Merge pull request #121 from vanpav/escaped-char

Escape Suggestion trigger char
This commit is contained in:
Philipp Kühn
2018-12-07 20:45:08 +01:00
committed by GitHub

View File

@@ -11,11 +11,12 @@ function triggerCharacter({
return $position => {
// Matching expressions used for later
const suffix = new RegExp(`\\s${char}$`)
const escapedChar = `\\${char}`
const suffix = new RegExp(`\\s${escapedChar}$`)
const prefix = startOfLine ? '^' : ''
const regexp = allowSpaces
? new RegExp(`${prefix}${char}.*?(?=\\s${char}|$)`, 'gm')
: new RegExp(`${prefix}(?:^)?${char}[^\\s${char}]*`, 'gm')
? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${escapedChar}|$)`, 'gm')
: new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm')
// Lookup the boundaries of the current node
const textFrom = $position.before()