22
33using System . ComponentModel . Composition ;
44using System . Diagnostics ;
5- using System . Threading ;
65using ChinesePinyinIntelliSenseExtender . Options ;
76using Microsoft . VisualStudio . Language . Intellisense . AsyncCompletion ;
8- using Microsoft . VisualStudio . Language . Intellisense . AsyncCompletion . Data ;
97using Microsoft . VisualStudio . Text ;
108using Microsoft . VisualStudio . Text . Editor ;
119using Microsoft . VisualStudio . Utilities ;
@@ -41,7 +39,7 @@ protected override IAsyncCompletionSource CreateCompletionSource(ITextView depen
4139 if ( ! Options . Enable
4240 || Options . AsyncCompletionMode == AsyncCompletionMode . Experimental )
4341 {
44- return EmptyAsyncCompletionSource . Instance ;
42+ return null ! ;
4543 }
4644
4745 var currentContentType = dependence . TextBuffer . ContentType ;
@@ -63,7 +61,7 @@ protected override IAsyncCompletionSource CreateCompletionSource(ITextView depen
6361 Debug . WriteLine ( $ "Total { otherAsyncCompletionSources ? . Count ?? 0 } IAsyncCompletionSource found.") ;
6462
6563 IAsyncCompletionSource completionSource = otherAsyncCompletionSources is null || otherAsyncCompletionSources . Count == 0
66- ? EmptyAsyncCompletionSource . Instance
64+ ? null !
6765 : new IdeographAsyncCompletionSource ( otherAsyncCompletionSources ! , Options ) ;
6866
6967 return completionSource ;
@@ -80,31 +78,8 @@ protected override IAsyncCompletionSource CreateCompletionSource(ITextView depen
8078
8179 protected override IAsyncCompletionSource GetDefaultCompletionSource ( ITextView dependence )
8280 {
83- return EmptyAsyncCompletionSource . Instance ;
81+ return null ! ;
8482 }
8583
8684 #endregion Protected 方法
87-
88- #region Private 类
89-
90- private sealed class EmptyAsyncCompletionSource : IAsyncCompletionSource
91- {
92- #region Public 属性
93-
94- public static EmptyAsyncCompletionSource Instance { get ; } = new ( ) ;
95-
96- #endregion Public 属性
97-
98- #region Public 方法
99-
100- public Task < CompletionContext > GetCompletionContextAsync ( IAsyncCompletionSession session , CompletionTrigger trigger , SnapshotPoint triggerLocation , SnapshotSpan applicableToSpan , CancellationToken token ) => Task . FromResult < CompletionContext > ( null ! ) ;
101-
102- public Task < object > GetDescriptionAsync ( IAsyncCompletionSession session , CompletionItem item , CancellationToken token ) => Task . FromResult < object > ( null ! ) ;
103-
104- public CompletionStartData InitializeCompletion ( CompletionTrigger trigger , SnapshotPoint triggerLocation , CancellationToken token ) => CompletionStartData . DoesNotParticipateInCompletion ;
105-
106- #endregion Public 方法
107- }
108-
109- #endregion Private 类
11085}
0 commit comments