emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.04k stars 139 forks source link

Add support for Strings as MarkedStrings #485

Closed J3RN closed 4 years ago

J3RN commented 4 years ago

Much of the context for this change can be found here: #478

To recap: The LSP spec for MarkedString is a union type of string and an object of the form { language: string; value: string }. The definition of the MarkedString type in lsp-protocol.el only supports the object and not string. Presently, lsp-mode has no support for union types.

In order to support this feature of the LSP spec, I added a check to see if the content received was a string, and if so treat it as a valid MarkedString containing markdown. This should be the correct behaviour as the LSP spec states:

 * MarkedString can be used to render human readable text. It is either a markdown string
 * or a code-block that provides a language and a code snippet.

This change also fixes the precise concern (elixir-ls not displaying documentation pop-ups) of #478.

image