Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use global options for async completion #32045

Merged
merged 4 commits into from
Jan 4, 2019
Merged

Conversation

ivanbasov
Copy link
Contributor

Tagging @AmadeusW for review as well

@ivanbasov ivanbasov added this to the 16.0.P2 milestone Dec 28, 2018
@ivanbasov ivanbasov requested review from jasonmalinowski, sharwell and a team December 28, 2018 22:31
@AmadeusW
Copy link
Contributor

AmadeusW commented Dec 28, 2018

Corresponding PRs in Visual Studio, FYI
https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/156960 - add the switch
https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform/pullrequest/157209 - consume value from the dialog and expose it as editor option #Resolved

Copy link
Contributor

@AmadeusW AmadeusW left a comment

Choose a reason for hiding this comment

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

Remove the UseAsyncCompletionOptionDefinition and read option by name UseAsyncCompletion


namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
{
[Export(typeof(EditorOptionDefinition))]
Copy link
Contributor

@AmadeusW AmadeusW Dec 28, 2018

Choose a reason for hiding this comment

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

I'm not sure if it's appropriate to export the option definition twice.
I'm exporting the definition in my PR so that I can write the value.
However, to read it, we identify it by string UseAsyncCompletion without the need for the definition. #Resolved

@ivanbasov
Copy link
Contributor Author

ivanbasov commented Jan 3, 2019

@AmadeusW please re-review
@jasonmalinowski , @jinujoseph please review. I think we'd like to target this for preview 2. #Resolved

@@ -85,12 +85,30 @@ public bool TryGetController(ITextView textView, ITextBuffer subjectBuffer, out

private bool UseLegacyCompletion(ITextView textView, ITextBuffer subjectBuffer)
{
const string useAsyncCompletionOptionName = "UseAsyncCompletion";
Copy link
Member

@jasonmalinowski jasonmalinowski Jan 3, 2019

Choose a reason for hiding this comment

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

Consider putting inside the "if", so it's easier to scan structure first. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Done


In reply to: 245165900 [](ancestors = 245165900)

@ivanbasov
Copy link
Contributor Author

tagging @jinujoseph for approval

else if (userSetting == -1)
{
_newCompletionAPIEnabled = false;
}
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Jan 4, 2019

Choose a reason for hiding this comment

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

i don't really understand where teh 1 and -1 values came from... How do you know it will be those values. Do we have code elsewhere that sets these? If so, can we define constants somewhere that we can share between the reading/writing code? #Resolved

Copy link
Contributor Author

@ivanbasov ivanbasov Jan 4, 2019

Choose a reason for hiding this comment

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

Good catch! Thank you, @CyrusNajmabadi! Let me add a comment #Resolved

Copy link
Contributor

@AmadeusW AmadeusW Jan 4, 2019

Choose a reason for hiding this comment

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

It corresponds to values of a three-state checkbox #Resolved

Copy link
Contributor

@AmadeusW AmadeusW Jan 4, 2019

Choose a reason for hiding this comment

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

and it is an convention used in VS settings #Resolved

if (Workspace.TryGetWorkspace(subjectBuffer.AsTextContainer(), out var workspace))
{
var experimentationService = workspace.Services.GetService<IExperimentationService>();
_newCompletionAPIEnabled = experimentationService.IsExperimentEnabled(WellKnownExperimentNames.CompletionAPI);
Copy link
Contributor

@AmadeusW AmadeusW Jan 4, 2019

Choose a reason for hiding this comment

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

if there is a chance of the if statement failing, consider setting _newCompletionAPIEnabled to something so that we avoid repeating work. If this won't fail, though, don't worry about it. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As soon as we get a workspace and an experimentation service, we should set _newCompletionAPIEnabled to a value. We should try checking unit this. Not?


In reply to: 245185354 [](ancestors = 245185354)

@ivanbasov ivanbasov merged commit e8c9d6f into master-vs-deps Jan 4, 2019
@ivanbasov ivanbasov deleted the experiment branch January 4, 2019 19:40
xoofx pushed a commit to stark-lang/stark-roslyn that referenced this pull request Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants