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

Handle nested code actions #753

Merged

Conversation

DustinCampbell
Copy link
Contributor

Fixes dotnet/vscode-csharp#302

This change digs into the first level of an action's "nested" code actions. This is a feature added more recently to Roslyn which is used to support code actions being hidden under submenus in VS. We can't assume submenu support in OmniSharp, so we expand the nested actions in place.

image

@DustinCampbell
Copy link
Contributor Author

My next PR will stop "Remove Unnecessary Usings" from showing here.

Copy link
Member

@david-driscoll david-driscoll left a comment

Choose a reason for hiding this comment

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

:shipit: 👍

await CollectRefactoringActions(refactoringContext.Value);
}

// TODO: Determine good way to order code actions.
actions.Reverse();
Copy link
Member

Choose a reason for hiding this comment

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

Any thoughts on this (besides just reversing the order like we do today?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have some notion of ordering in Roslyn using attributes but it's messy. At some point, I intend to order them similarly in OmniSharp, but it's down the priority list a bit. For now, I just wanted to add a TODO to indicate that it wasn't ideal. 😄

protected BaseCodeActionService(OmniSharpWorkspace workspace, CodeActionHelper helper, IEnumerable<ICodeActionProvider> providers, ILogger logger)
{
this.Workspace = workspace;
this.Providers = providers;
this.Logger = logger;
this._helper = helper;

// Sadly, the CodeAction.NestedCodeActions property is still internal.
Copy link
Member

Choose a reason for hiding this comment

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

👎 (at it still being internal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We discussed making it public awhile back, but we tabled the issue because folks didn't like the word "Nested" or "Composite" because it's really about grouping related code actions together rather than making up a larger code action out of little ones. I need to bring this back up with the team again.

@DustinCampbell
Copy link
Contributor Author

Thanks for the approval! Burning down some bugs. 😄

@DustinCampbell DustinCampbell merged commit 1ddab74 into OmniSharp:dev Feb 5, 2017
@DustinCampbell DustinCampbell deleted the handle-nested-code-actions branch February 8, 2017 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants