{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/27930","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/27930/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/27930/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/27930/events","html_url":"https://github.com/dotnet/roslyn/pull/27930","id":333002284,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MzQxMjU1","number":27930,"title":"Change order of C# completion providers to get better completions for type parameter T","user":{"login":"jhinder","id":823398,"node_id":"MDQ6VXNlcjgyMzM5OA==","avatar_url":"https://avatars2.githubusercontent.com/u/823398?v=4","gravatar_id":"","url":"https://api.github.com/users/jhinder","html_url":"https://github.com/jhinder","followers_url":"https://api.github.com/users/jhinder/followers","following_url":"https://api.github.com/users/jhinder/following{/other_user}","gists_url":"https://api.github.com/users/jhinder/gists{/gist_id}","starred_url":"https://api.github.com/users/jhinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhinder/subscriptions","organizations_url":"https://api.github.com/users/jhinder/orgs","repos_url":"https://api.github.com/users/jhinder/repos","events_url":"https://api.github.com/users/jhinder/events{/privacy}","received_events_url":"https://api.github.com/users/jhinder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-16T17:27:39Z","updated_at":"2018-06-20T19:55:58Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/27930","html_url":"https://github.com/dotnet/roslyn/pull/27930","diff_url":"https://github.com/dotnet/roslyn/pull/27930.diff","patch_url":"https://github.com/dotnet/roslyn/pull/27930.patch"},"body":"Fixes #24960.\r\n\r\nWhen [`CompletionServiceWithProviders.AddToDisplayMap`](http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/Completion/CompletionServiceWithProviders.cs,368) detects a duplicate completion item, it hands the old and new items to [`GetBetterItem`](http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/Completion/CompletionServiceWithProviders.cs,405), which will always pick the item that came later. Because the `SpeculativeTCompletionProvider` currently comes after the `SymbolCompletionProvider`, the meaningful T item will always get overridden by the speculative T item.\r\n\r\nWith this patch the `SpeculativeTCompletionProvider` moves up the list of default completion providers a bit, in front of the `SymbolCompletionProvider`. Now, when the user brings up the completion list, the meaningful T item (with the \"T in Class&lt;T&gt;\" tooltip) will override the speculative T item.\r\n\r\nSide note: I don't know how to add a unit test for this, because the test [`SymbolCompletionProviderTests.DescriptionGenericTypeParameter`](http://source.roslyn.io/#Roslyn.Services.Editor.CSharp.UnitTests/Completion/CompletionProviders/SymbolCompletionProviderTests.cs,3295) already covers this case, but it didn't fail before, because the completion service has different behaviours: during test execution, the local var [`providers` in `CompletionServiceWithProvidera.GetCompletionAsync`](http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/Completion/CompletionServiceWithProviders.cs,224) has only one provider, a `SymbolCompletionProvider` (which returns the correct result); when run as part of *VisualStudioSetup*, `providers` contains 22 providers."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/398876308","html_url":"https://github.com/dotnet/roslyn/pull/27930#issuecomment-398876308","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/27930","id":398876308,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODg3NjMwOA==","user":{"login":"jasonmalinowski","id":201340,"node_id":"MDQ6VXNlcjIwMTM0MA==","avatar_url":"https://avatars3.githubusercontent.com/u/201340?v=4","gravatar_id":"","url":"https://api.github.com/users/jasonmalinowski","html_url":"https://github.com/jasonmalinowski","followers_url":"https://api.github.com/users/jasonmalinowski/followers","following_url":"https://api.github.com/users/jasonmalinowski/following{/other_user}","gists_url":"https://api.github.com/users/jasonmalinowski/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonmalinowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonmalinowski/subscriptions","organizations_url":"https://api.github.com/users/jasonmalinowski/orgs","repos_url":"https://api.github.com/users/jasonmalinowski/repos","events_url":"https://api.github.com/users/jasonmalinowski/events{/privacy}","received_events_url":"https://api.github.com/users/jasonmalinowski/received_events","type":"User","site_admin":false},"created_at":"2018-06-20T19:55:58Z","updated_at":"2018-06-20T19:55:58Z","author_association":"MEMBER","body":"FYI to @dpoeschl who might already have fixed this in the new implementation. (Or might not have!)"}}
{"actor":{"display_login":"jasonmalinowski"}}