Skip to content

Commit

Permalink
Merge pull request #1670 from filipw/bugfix/decode-symbol
Browse files Browse the repository at this point in the history
fixed symbol decoding from completion items
  • Loading branch information
filipw authored Jan 6, 2020
2 parents 3b6de52 + fef42ac commit 43f962a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
All changes to the project will be documented in this file.

## [1.34.10] - not yet released
* Fixed a bug where completion items didn't decode symbols corectly (impacted, for example, object initializer completion quality) ([omnisharp-vscode#3465](https://github.com/OmniSharp/omnisharp-vscode/issues/3465), PR: [#1670](https://github.com/OmniSharp/omnisharp-roslyn/pull/1670))
* Updated to MsBuild 16.4.0 on Linux/MacOS (PR:[#1669](https://github.com/OmniSharp/omnisharp-roslyn/pull/1669))

## [1.34.9] - 2019-12-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ internal static class CompletionItemExtensions
private const string ParitalMethodCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.PartialMethodCompletionProvider";
private const string ProviderName = nameof(ProviderName);
private const string SymbolCompletionItem = "Microsoft.CodeAnalysis.Completion.Providers.SymbolCompletionItem";
private const string SymbolCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.SymbolCompletionProvider";
private const string SymbolKind = nameof(SymbolKind);
private const string SymbolName = nameof(SymbolName);
private const string Symbols = nameof(Symbols);
Expand Down Expand Up @@ -49,7 +48,9 @@ public static bool IsObjectCreationCompletionItem(this CompletionItem item)

public static async Task<IEnumerable<ISymbol>> GetCompletionSymbolsAsync(this CompletionItem completionItem, IEnumerable<ISymbol> recommendedSymbols, Document document)
{
if (completionItem.GetType() == _symbolCompletionItemType)
var properties = completionItem.Properties;

if (completionItem.GetType() == _symbolCompletionItemType || properties.ContainsKey(Symbols))
{
var decodedSymbolsTask = _getSymbolsAsync.InvokeStatic<Task<ImmutableArray<ISymbol>>>(new object[] { completionItem, document, default(CancellationToken) });
if (decodedSymbolsTask != null)
Expand All @@ -58,8 +59,6 @@ public static async Task<IEnumerable<ISymbol>> GetCompletionSymbolsAsync(this Co
}
}

var properties = completionItem.Properties;

// if the completion provider encoded symbols into Properties, we can return them
if (properties.ContainsKey(SymbolName) && properties.ContainsKey(SymbolKind))
{
Expand Down
1 change: 1 addition & 0 deletions tests/OmniSharp.Roslyn.CSharp.Tests/IntellisenseFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public MyClass2()

var completions = await FindCompletionsAsync(filename, source);
ContainsCompletions(completions.Select(c => c.CompletionText), "Foo");
ContainsCompletions(completions.Select(c => c.ReturnType), "string");
}

[Theory]
Expand Down

0 comments on commit 43f962a

Please sign in to comment.