omnisharp-server icon indicating copy to clipboard operation
omnisharp-server copied to clipboard

Refactor create property

Open jamlen opened this issue 7 years ago • 2 comments

I'm on day one of using OmniSharp but once I got it running in Spacemacs (via omnisharp-emacs), the result of a refactor (omnisharp-run-code-action-refactoring) was not what I was expecting.

Given this:

public class MyType
{
  public string Name { get; set; }
}

var a = new MyType
  {
    Name = "Talula",
    NewField = 1234  // <- Refactor create property
  };

I was expecting:

public class MyType
{
  public string Name { get; set; }
  int NewField { get; set; }
}


var a = new MyType
  {
    Name = "Talula",
    NewField = 1234
  };

But what I got was:

public class MyType
{
  public string Name { get; set; }
}

int NewField
{
  get; 
  set;
}

var a = new MyType
  {
    Name = "Talula",
    NewField = 1234
  };

jamlen avatar Dec 16 '16 07:12 jamlen

Think you are using omnisharp-server backend here based on NRefactory. There is a newer backend (omnisharp-roslyn) but I don't think omnisharp-emacs supports it. Most of the omnisharp-roslyn backend will work with master omnisharp-emacs (with the exception of refactorings!! - the API changed)

There is a branch here https://github.com/OmniSharp/omnisharp-emacs/tree/feature-omnisharp-roslyn-support but I don't think it was ever finished. Not sure what state this branch is in.

If that doesn't work for you, you're probably SOL unless you want to get your hands dirty. The omnisharp-emacs author (@sp3ctum) doesn't work on the project any more.

nosami avatar Dec 16 '16 11:12 nosami

Hi, I can confirm what @nosami said. I've been putting off laying the project off my shoulders for way too long now. I'll add something to the readme files to make it official.

mikavilpas avatar Dec 16 '16 11:12 mikavilpas