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

Wrap calls to CompletionProvider extensions such that they go through our extension manager #70843

Merged
merged 11 commits into from
Nov 16, 2023

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Nov 15, 2023

Fixes #70830
Fixes #70786

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 15, 2023
or CodeRefactoringProvider
or CodeRefactorings.FixAllProvider
or CodeFixes.FixAllProvider
or CompletionProvider)
Copy link
Member Author

Choose a reason for hiding this comment

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

added CompletionProvider here. That way this participates in teh yellow-bar, telling the user about the completion provider that thrw the exception and if htey want to enable it.

{
if (!IsIgnored(provider) &&
_globalOptions.GetOption(ExtensionManagerOptions.DisableCrashingExtensions))
Copy link
Member Author

Choose a reason for hiding this comment

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

this option was always true, and had no way to configure it. removed it.

await task.ConfigureAwait(false);

if (actions.Count == 0)
return extensionManager.PerformFunctionAsync(
Copy link
Member Author

Choose a reason for hiding this comment

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

moved all explicit try/catch code with extension manager to use the existing helper functions that already do the right thing.

return false;
}
protected override void HandleNonCancellationException(object provider, Exception exception)
=> _logger.Log(LogLevel.Error, exception, $"{provider.GetType()} threw an exception.");
Copy link
Member Author

Choose a reason for hiding this comment

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

@dibarbet Despite having no UI for ut, we're still not disabling the providers when they crash. IMO, we should do that in LSP, otherwise we can just continue calling into them, and they will continue crashing. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Talked offline - fine with this for this PR. Tracking issue here #70844 to enable a similar UI that VS has.

@@ -4,127 +4,121 @@

Copy link
Member Author

Choose a reason for hiding this comment

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

view with whitespace off.

[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class TestExtensionManager(
[Import] TestExtensionErrorHandler errorHandler) : AbstractExtensionManager
Copy link
Member Author

Choose a reason for hiding this comment

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

this import seems sus


void HandleException(object provider, Exception exception);
Copy link
Member Author

Choose a reason for hiding this comment

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

merged these into one helper. much simpler and cleaner. especially as some CanHandleException helpers were stateful!

@jbevain
Copy link
Contributor

jbevain commented Nov 15, 2023

@CyrusNajmabadi also fixes #70786 no?

@CyrusNajmabadi
Copy link
Member Author

@jbevain yup!

@CyrusNajmabadi CyrusNajmabadi merged commit cd6c73a into dotnet:main Nov 16, 2023
19 of 24 checks passed
@ghost ghost added this to the Next milestone Nov 16, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the extensionManager branch November 16, 2023 17:00

public override void HandleException(object provider, Exception exception)
if (provider is CodeFixProvider
or CodeRefactoringProvider
Copy link
Member

Choose a reason for hiding this comment

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

Add QuickInfoProvider too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
5 participants