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

Code actions not making any changes to documents when selected #2607

Open
mcraveiro opened this issue Mar 7, 2024 · 3 comments
Open

Code actions not making any changes to documents when selected #2607

mcraveiro opened this issue Mar 7, 2024 · 3 comments

Comments

@mcraveiro
Copy link

Thanks very much for an extremely useful product. I have a bit of an exploratory question. I am using Omnisharp on Windows with Emacs:

  • Operative System: Windows 10
  • LSP server: Omnisharp 1.39
  • Emacs: 29.1
  • Programming language: C# (csharp-mode)

Omnisharp works great except for the code actions. I get a list of code actions but when I select them, nothing happens. I am investigating the issue here: joaotavora/eglot#1322

What I'd like to know is, are the files modified by Omnisharp or by Emacs on a code action request? I tried debugging, and it seems like the editor is requesting the server for the changes. If that is the case, is there a log in Omnisharp I could consult to see why the files are not changing?

Many thanks for your time,

@mcraveiro
Copy link
Author

I created a discussion in reddit to see if I can gather more information on this matter. [1]

[1] https://www.reddit.com/r/emacs/comments/1bawgko/eglot_code_actions_do_not_change_the_buffer/

@mcraveiro
Copy link
Author

After a fair bit of debugging with the eglot developer [1], we finally understand the problem a bit better. It seems that Omnisharp is not sending either edit or command in the code actions message. Here is an example message as we see it in Emacs:

(:title "Generate variable 'xConnssole' -> Generate field 'xConnssole'" :kind "quickfix" :diagnostics
               []
               :data
               (:Uri "file:///home/user/dotnet/Program.cs" :Identifier "Generate field 'xConnssole'" :Name "Generate variable 'xConnssole' -> Generate field 'xConnssole'" :Range
                     (:Start
                       (:Line 12 :Character 12)
                       :End
                       (:Line 12 :Character 22))
                     :$$__handler_id__$$ "2e314f16-b735-46d8-ab39-2c20ee0d8960"))

Is there any reason why Omnisharp would do that? I have been reading through the code action spec [2] but unfortunately it isn't obvious if these parameters are mandatory or not.

[1] joaotavora/eglot#1322 (reply in thread)
[2] https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction

@bodnarlajos
Copy link

Same issue for me.
I just mention that with the same OmniSharp the vscode works well...

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

No branches or pull requests

2 participants