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

lsp-csharp: handle interop notifications #2196

Merged

Conversation

razzmatazz
Copy link
Collaborator

This adds handlers for '#o/XXX' notifications that have been added recently to facilitate omnisharp clients transitioning from custom to LSP protocol (see OmniSharp/omnisharp-roslyn#1911).

The events are ignored by default, except for 'o#/error' which may help resolving issues when projects are not being properly loaded (this may have helped to diagnose #2188)

These were added by
OmniSharp/omnisharp-roslyn#1911
to facilitate legacy clients (i.e. vscode) that will be transitioning to
LSP.
This improves diagnostic procedure when projects cannot be loaded for
some reason.
@github-actions github-actions bot added the client One or more of lsp-mode language clients label Sep 20, 2020
@@ -246,6 +246,11 @@ using the `textDocument/references' request."
(lsp-show-xrefs (lsp--locations-to-xref-items locations-found) nil t)
(message "No references found")))

(defun lsp-csharp--handle-os-error (_workspace params)
"Handle the 'o#/error' (interop) notification with PARAMS by displaying a message with lsp-warn."
(-let (((&hash "FileName" filename "Text" text) params))
Copy link
Member

Choose a reason for hiding this comment

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

we should not use &hash because soon we will switch to plist for internal representation of the jsonrpc objects.

You have 2 options:

  1. Use lsp-get
  2. Define data structures and then use the getters/destructorings generated for the interface.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done (with opt 2)

Copy link
Member

@ericdallo ericdallo left a comment

Choose a reason for hiding this comment

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

I faced this issue today 😅
Thanks for your contribution!

@ericdallo ericdallo merged commit c01dab7 into emacs-lsp:master Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants