From eeed66a95482f8d0f34f8bb4521988eed9a9c332 Mon Sep 17 00:00:00 2001 From: Tobias Davis Date: Sun, 20 Aug 2023 17:33:43 -0500 Subject: [PATCH] fix: do not suggest on emails etc --- main.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 236001b..735a6b2 100644 --- a/main.js +++ b/main.js @@ -76,10 +76,20 @@ class AtPeopleSuggestor extends EditorSuggest { this.peopleFileMap = peopleFileMap } onTrigger(cursor, editor, tFile) { + console.log('----editor', editor) let charsLeftOfCursor = editor.getLine(cursor.line).substring(0, cursor.ch) let atIndex = charsLeftOfCursor.lastIndexOf('@') let query = atIndex >= 0 && charsLeftOfCursor.substring(atIndex + 1) - if (query && !query.includes(']]')) { + if ( + query + && !query.includes(']]') + && ( + // if it's an @ at the start of a line + atIndex === 0 + // or if there's a space character before it + || charsLeftOfCursor[atIndex - 1] === ' ' + ) + ) { return { start: { line: cursor.line, ch: atIndex }, end: { line: cursor.line, ch: cursor.ch },