csharp-language-server icon indicating copy to clipboard operation
csharp-language-server copied to clipboard

"Generate overrides..." code action always fails

Open razzmatazz opened this issue 2 years ago • 5 comments

As reported here:

  • https://github.com/emacs-lsp/lsp-mode/issues/3558

FYI @pro-anon

razzmatazz avatar Jun 07 '22 18:06 razzmatazz

My project is just a standard ASP.NET Core with Identity btw. I was trying to override the OnModelCreating method

pro-anon avatar Jun 07 '22 18:06 pro-anon

I think this action needs parameters to be passed to it and we don't provide any as LSP protocol does not AFAIK support this flow; lets see if we can provide some default values/parameters to the action so that something is generated by the code action sufficiently usefuly

razzmatazz avatar Jun 21 '22 20:06 razzmatazz

at the moment GenerateOverridesCodeRefactoringProvider requires IPickMemberService (which is internal) to be injected but to mock it we need to do some run-time type building, probably using Castle.Proxy or something like that as the type is internal.. postponing this until IPickMembersService becomes public or this issue gets more attention.

razzmatazz avatar Jul 14 '22 09:07 razzmatazz

I believe things should work as of https://github.com/razzmatazz/csharp-language-server/commit/bbe04d15c18f41f3c9a56da42fbc5a33209bf0dd (new version has not been released yet)

I have added some castle.core proxy overrides for internal roslyn types so those code actions should work with default selections (i.e. it will generate overrides for all virtual object members as there is no way to provide UI in LSP AFAIK)

razzmatazz avatar Sep 05 '22 09:09 razzmatazz

I have released 0.5.6 on nuget which should fix the issue:

  • https://www.nuget.org/packages/csharp-ls/0.5.6

razzmatazz avatar Sep 05 '22 12:09 razzmatazz