Skip to content

Fix #36060: Group Completion Providers using IsExclusive#36088

Merged
jasonmalinowski merged 1 commit intodotnet:masterfrom
avodovnik:dev/anvod/exclusivecompletion
Jun 18, 2019
Merged

Fix #36060: Group Completion Providers using IsExclusive#36088
jasonmalinowski merged 1 commit intodotnet:masterfrom
avodovnik:dev/anvod/exclusivecompletion

Conversation

@avodovnik
Copy link
Copy Markdown
Contributor

@avodovnik avodovnik commented May 31, 2019

As per the discussion in #36060, this PR attempts to introduce the change that would allow a CompletionProvider to add items to the list, even if another one sets IsExclusive, like in the example of an OverrideCompletionProvider. This is partially only there to support a feature used by VS Mac.

It's marked as a WIP as I'd still like to introduce a test for this, but want comments on the change as soon as possible to see if I should change direction.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Seems reasonable to me. tagging @dpoeschl @ivanbasov see linked conversation for more details (including my thoughts on why i think this is probably the best of the potential options).

@avodovnik avodovnik force-pushed the dev/anvod/exclusivecompletion branch from 7cc1de7 to d99c4e4 Compare June 3, 2019 07:57
@dnfclas
Copy link
Copy Markdown

dnfclas commented Jun 3, 2019

CLA assistant check
All CLA requirements met.

@avodovnik avodovnik force-pushed the dev/anvod/exclusivecompletion branch from d99c4e4 to 0f1cc0e Compare June 3, 2019 07:57
@avodovnik avodovnik marked this pull request as ready for review June 3, 2019 08:37
@avodovnik avodovnik requested a review from a team as a code owner June 3, 2019 08:37
Copy link
Copy Markdown
Contributor

@ivanbasov ivanbasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Note: if we go this path, we'd certainly benefit from tests. We should also update our docs to explain what's going on here. But the design is 100% ok with me personally.

@avodovnik
Copy link
Copy Markdown
Contributor Author

I’ve added a fairly simple, happy path, test. Have you got any suggestions on how else I could test this? Happy to also update the docs if needed, TBH.

Private Shared s_providers As ImmutableArray(Of CompletionProvider) = ImmutableArray.Create(Of CompletionProvider)(
New TestCompletionProviderWithMockExclusivity(False, CompletionServiceTests_Exclusivity.CompletionItemNonExclusive, 1),
New TestCompletionProviderWithMockExclusivity(True, CompletionServiceTests_Exclusivity.CompletionItemExclusive, 2),
New TestCompletionProviderWithMockExclusivity(True, CompletionServiceTests_Exclusivity.CompletionItemExclusive, 3))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the test!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

I’ve added a fairly simple, happy path, test. Have you got any suggestions on how else I could test this?

The test is satisfactory to me :)

Happy to also update the docs if needed, TBH.

Please do. Right now this is in conflict with the specified text.

--

@ivanbasov i'm not sure if the IDE has a compat meeting. But this likely shoudl go through that (or a design meeting) before merging, just to make sure everyone is ok. I doubt there is an issue. But as it is a chnage of design in a public API, we should be conscientious here.

@ivanbasov
Copy link
Copy Markdown
Contributor

@ivanbasov i'm not sure if the IDE has a compat meeting. But this likely shoudl go through that (or a design meeting) before merging, just to make sure everyone is ok. I doubt there is an issue. But as it is a chnage of design in a public API, we should be conscientious here.

Thank you, @CyrusNajmabadi ! I would say that the change is a fix for a corner case bug. The original design missed the case when more than 1 provider declared itself exclusive. Taking the first one was just a temporarily solution.

I understand and support the update to the design claiming that all providers declared themselves exclusive should be considered at the same level of exclusiveness.

If we would see that one providers may be more exclusive than other exclusive providers, we would re-consider this.

Adding @jasonmalinowski, @sharwell and @jinujoseph to see if they want to consider this change on a design meeting.

@jinujoseph jinujoseph added Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. labels Jun 4, 2019
@jinujoseph jinujoseph added this to the 16.2.P3 milestone Jun 4, 2019
@jinujoseph jinujoseph added the Need Design Review The end user experience design needs to be reviewed and approved. label Jun 4, 2019
@abock
Copy link
Copy Markdown
Contributor

abock commented Jun 4, 2019

Thank you for considering this! I just want to chime in and vote for this - without it, the user experience in VS Mac will regress in the Xamarin iOS workload with the new editor that we have ported from VS Windows, since we cannot feasibly shoehorn in protocol "overrides" at the editor level anymore.

Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design seems fine by me. It seems the only way this would break an experience is:

  1. We had two providers all along saying they wanted to be exclusive, but we don't want both (i.e. one of them is wrong), and
  2. All along we were getting lucky that the buggy one was the one that was coming "second" so we never noticed.

If I recall the alternative design we had for "exclusive" providers years ago was we would order providers so the override provider went "first" -- it's ironic that we still created an ordering requirement anyways. 😄

@AmadeusW @ivanbasov @dpoeschl Does the new editor API also expose an equivalent concept of "exclusive"? Which way does it behave?

@jasonmalinowski
Copy link
Copy Markdown
Member

I'm also not sure this is worth discussing at today's design meeting. I'd vote to remove it from the agenda unless somebody else actually wants to discuss it. FYI to @sharwell.

@jinujoseph jinujoseph removed the Need Design Review The end user experience design needs to be reviewed and approved. label Jun 17, 2019
@jasonmalinowski jasonmalinowski merged commit 3a364d2 into dotnet:master Jun 18, 2019
@jasonmalinowski
Copy link
Copy Markdown
Member

Thanks @avodovnik for the fix!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Nice! I'm glad we could make such a simple solution that solved your needs!

@jinujoseph jinujoseph removed this from the 16.2 milestone Jun 18, 2019
@jinujoseph jinujoseph added this to the 16.2.P4 milestone Jun 18, 2019
@jinujoseph
Copy link
Copy Markdown
Contributor

Should be available in 16.2.Preview4 onwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved to merge Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants