@@ -87,36 +87,36 @@ public override void RegisterCapability(ServerCapabilities serverCapabilities, C
8787 return new CompletionResponse ( completionItems ) ;
8888 } ) ;
8989 }
90- protected override async Task < CompletionItem > Resolve ( CompletionItem item , CancellationToken token ) {
91- if ( documentId == null || item . Data ? . Value == null || completionItemsCache == null )
92- return item ;
93- if ( ! completionItemsCache . TryGetValue ( ( int ) item . Data . Value , out var roslynCompletionItem ) ) {
94- currentClassLogger . Debug ( $ "Completion item with data:[{ item . Data . Value } ] not found in cache.") ;
95- return item ;
96- }
90+ protected override Task < CompletionItem > Resolve ( CompletionItem item , CancellationToken token ) {
91+ return SafeExtensions . InvokeAsync < CompletionItem > ( item , async ( ) => {
92+ if ( documentId == null || item . Data ? . Value == null || completionItemsCache == null )
93+ return item ;
94+ if ( ! completionItemsCache . TryGetValue ( ( int ) item . Data . Value , out var roslynCompletionItem ) )
95+ return item ;
9796
98- var document = workspaceService . Solution ? . GetDocument ( documentId ) ;
99- if ( completionService == null || document == null ) {
100- currentClassLogger . Debug ( $ "Roslyn completion service not found for document:[{ document } ].") ;
101- return item ;
102- }
97+ var document = workspaceService . Solution ? . GetDocument ( documentId ) ;
98+ if ( completionService == null || document == null ) {
99+ currentClassLogger . Debug ( $ "Roslyn completion service not found for document:[{ document } ].") ;
100+ return item ;
101+ }
103102
104- if ( item . Documentation == null ) {
105- var description = await completionService . GetDescriptionAsync ( document , roslynCompletionItem , token ) . ConfigureAwait ( false ) ;
106- if ( description != null ) {
107- item . Documentation = new MarkupContent ( ) {
108- Kind = MarkupKind . Markdown ,
109- Value = MarkdownConverter . TaggedTextToMarkdown ( description . TaggedParts )
110- } ;
103+ if ( item . Documentation == null ) {
104+ var description = await completionService . GetDescriptionAsync ( document , roslynCompletionItem , token ) . ConfigureAwait ( false ) ;
105+ if ( description != null ) {
106+ item . Documentation = new MarkupContent ( ) {
107+ Kind = MarkupKind . Markdown ,
108+ Value = MarkdownConverter . TaggedTextToMarkdown ( description . TaggedParts )
109+ } ;
110+ }
111111 }
112- }
113112
114- if ( item . TextEdit == null && roslynCompletionItem . IsComplexTextEdit ) {
115- var sourceText = await document . GetTextAsync ( token ) . ConfigureAwait ( false ) ;
116- await ResolveComplexItemAsync ( completionService , roslynCompletionItem , item , offset , document , sourceText , token ) . ConfigureAwait ( false ) ;
117- }
113+ if ( item . TextEdit == null && roslynCompletionItem . IsComplexTextEdit ) {
114+ var sourceText = await document . GetTextAsync ( token ) . ConfigureAwait ( false ) ;
115+ await ResolveComplexItemAsync ( completionService , roslynCompletionItem , item , offset , document , sourceText , token ) . ConfigureAwait ( false ) ;
116+ }
118117
119- return item ;
118+ return item ;
119+ } ) ;
120120 }
121121
122122 //https://github.com/OmniSharp/omnisharp-roslyn/blob/c38e89b04a97ec8bc488926ef2f501d7401c4b33/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Sync.cs#L135
0 commit comments