11using System ;
22using System . ComponentModel . Composition ;
3+ using System . Runtime . InteropServices ;
4+ using Microsoft . VisualStudio ;
35using Microsoft . VisualStudio . Editor ;
46using Microsoft . VisualStudio . Language . Intellisense ;
57using Microsoft . VisualStudio . OLE . Interop ;
68using Microsoft . VisualStudio . Text ;
79using Microsoft . VisualStudio . Text . Editor ;
810using Microsoft . VisualStudio . TextManager . Interop ;
911using Microsoft . VisualStudio . Utilities ;
10- using Microsoft . VisualStudio ;
11- using System . Runtime . InteropServices ;
1212
1313namespace Glyphfriend . Helpers
1414{
@@ -28,7 +28,10 @@ public void VsTextViewCreated(IVsTextView textViewAdapter)
2828 // If the Emojis haven't been loaded, load them
2929 if ( GlyphfriendPackage . Emojis == null )
3030 {
31- GlyphfriendPackage . LoadEmojis ( ) ;
31+ System . Threading . Tasks . Task . Run ( ( ) =>
32+ {
33+ GlyphfriendPackage . LoadEmojis ( ) ;
34+ } ) ;
3235 }
3336
3437 // Set up the Completion handler for Markdown documents
@@ -91,7 +94,7 @@ public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pv
9194 hresult = Next . Exec ( pguidCmdGroup , nCmdID , nCmdexecopt , pvaIn , pvaOut ) ;
9295 }
9396
94- // After the pre-processing has been performed, evaluate the current state
97+ // After the pre-processing has been performed, evaluate the current state
9598 // and session
9699 if ( ErrorHandler . Succeeded ( hresult ) )
97100 {
@@ -153,6 +156,13 @@ private bool Start()
153156 SnapshotPoint caret = _textView . Caret . Position . BufferPosition ;
154157 ITextSnapshot snapshot = caret . Snapshot ;
155158
159+ if ( caret > 1 )
160+ {
161+ char prev = snapshot . GetText ( caret - 2 , 1 ) [ 0 ] ;
162+ if ( ! char . IsWhiteSpace ( prev ) )
163+ return false ;
164+ }
165+
156166 // Generate a session based off of the existing broker and textview
157167 if ( ! _broker . IsCompletionActive ( _textView ) )
158168 {
@@ -177,7 +187,7 @@ private bool Complete(bool force)
177187 {
178188 return false ;
179189 }
180-
190+
181191 // Based off of the available selection, determine if it should be dismissed (via Dismiss) or
182192 // output (via Commit)
183193 if ( ! _currentSession . SelectedCompletionSet . SelectionStatus . IsSelected && ! force )
@@ -213,7 +223,7 @@ private bool Cancel()
213223 {
214224 return false ;
215225 }
216-
226+
217227 // Explicitly cancel the current session
218228 _currentSession . Dismiss ( ) ;
219229
@@ -223,7 +233,7 @@ private bool Cancel()
223233 private bool DoesSessionExist
224234 {
225235 // Ensures that the current session exists
226- get { return _currentSession != null ; }
236+ get { return _currentSession != null ; }
227237 }
228238
229239 private static char GetTypeChar ( IntPtr pvaIn )
0 commit comments