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

[BUG] Can't extract interface #6430

Closed
arunchndr opened this issue Sep 25, 2023 · 12 comments · Fixed by dotnet/roslyn#76718
Closed

[BUG] Can't extract interface #6430

arunchndr opened this issue Sep 25, 2023 · 12 comments · Fixed by dotnet/roslyn#76718

Comments

@arunchndr
Copy link
Member

From vscode-dotnettools created by julioct: microsoft/vscode-dotnettools#545

Describe the Issue

Extracting an interface is an essential part of day-to-day coding activities, but with the latest C# extension version you can't do it.

In version 1.26.0:

image

In latest version:

image

Can we get the Extract interface... context menu item back?

Steps To Reproduce

  1. Use the lightbulb to open the context menu item on any class
  2. The extract interface... context menu item is not there

Expected Behavior

The extract interface... context menu item should be there.

Environment Information

  • OS: Windows 11
  • VS Code version: Code - Insiders 1.83.0-insider
  • Extension version: 2.2.10
@arunchndr
Copy link
Member Author

O# feature gap fill.

@m-abs
Copy link

m-abs commented Oct 24, 2023

Temp workaround:

Open workspace settings (json)
Add:

{
  "dotnet.server.useOmnisharp": true,
...
}

@vadimkholodilo
Copy link

When is this feature going to be implemented? It's a very important one, in my opinion. I think VSCode is very close to replacing Visual Studio for Small to medium projects

@julioct
Copy link

julioct commented Dec 26, 2023

Temp workaround:

Open workspace settings (json) Add:

{
  "dotnet.server.useOmnisharp": true,
...
}

That doesn't help with C# Dev Kit installed, which most people would want to use:

image

This is so basic. Any updates on proper support?

@mathmul
Copy link

mathmul commented Jan 19, 2024

I have "C#" (Microsoft) and "C# Extensions" (JosKreativ) extension installed but not "C# Dev Kit" and it still doesn't work with Omnisharp :/

Edit: Right click on class name, choose "Refactor" (Ctrl+Shift+R), choose "Extract Interface...". Worked for me, but only with Omnisharp option ON.

@kyeede
Copy link

kyeede commented Mar 11, 2024

Months go by with this issue persisting. It actually hinders productivity by quite a lot having to manually implement interfaces and abstract classes. Disabling C# DevKit and enabling OmniSharp does resolve the issue but the extension itself along with other useful dependencies help with development.

Any updates or progress on this?

@Cosifne
Copy link
Member

Cosifne commented Mar 12, 2024

I took a closer look at this feature.
From O#, it looks like,

  1. It simply gets all the code action providers from Roslyn
  2. For extract interface, it creates many wrapper types in the code path when code action is invoked
    I. https://github.com/dotnet/roslyn/blob/main/src/Tools/ExternalAccess/OmniSharp/Internal/ExtractInterface/OmniSharpExtractInterfaceOptionsService.cs
    II. https://github.com/OmniSharp/omnisharp-roslyn/blob/ac7b9b8509356e39583de2b9fdf363005e6c8595/src/OmniSharp.Roslyn/WorkspaceServices/ExtractInterfaceWorkspaceService.cs#L19
    In simply words, it extracts all the extractable symbol in the type to a new interface. (In VS, we create UI to let user make choice)

If we want to close the gap between O#, it's easy to just create similar types in our LSP layers. But it's hard to create a similar thing in VS, because we don't control any UI in VSCode.

@BrachaG
Copy link

BrachaG commented Mar 21, 2024

Any updates or progress on this?

@sys58260
Copy link

sys58260 commented May 9, 2024

Is it foreseen in near future?
Thanks.

@Thiago-Morais
Copy link

Is there any update on this?

@dibarbet dibarbet modified the milestones: October2023, June2024 May 23, 2024
@dibarbet dibarbet modified the milestones: June2024, August2024 Jul 31, 2024
@Apollo3zehn
Copy link

C# support gets worse and worse :-(

@philippjbauer
Copy link

It's really unfortunate that this feature is still not available again. It was a huge help to just be able to extract an interface quickly. And copilot is not able to extract an interface reliably ...

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