Language-server-protocol: Proposal: treat `CompletionItem#description` as markdown

Created on 3 Nov 2016  路  16Comments  路  Source: microsoft/language-server-protocol

In the polymer language server we have the same documentation available for a symbol whether we're autocompleting it or giving the docs on hover. I expect most other servers to be in a similar boat. The markdown rendering for hover documentation is great, and we'd like to have similar rendering for the same content.

feature-request

Most helpful comment

Instead of blacklisting all聽script execution attributes, you can just whitelist聽safe聽attributes. Normally you don't use that many attributes in HTML in markdown, it's mostly聽basic elements like the ones I mentioned above that could also be represented in markdown.

All 16 comments

In general whenever the LSP passes a strings to be displayed to the user (also showMessage for instance) it should allow the same kind of mark up.
Always assuming markdown seems good enough to me.

@rictic are you talking about details or documentation. I agree it would make sense to allow markdown in the documentation part.

@jrieken did you have such requests against the VS Code API as well ?

@dbaeumer Yeah, I'm talking about documentation. No opinion on details.

Yes - we have request to allow markdown in more places but haven't tackled that yet

@jrieken cool. We keep it as a feature request then.

The PHP stubs for the PHP standard libraries all contain HTML in their docblocks, which looks awful at the moment. Using markdown in docblocks is very common, and would also solve the HTML case, since markdown can contain HTML.

and would also solve the HTML case, since markdown can contain HTML.

fyi - we currently don't allow html in markdown

Any聽reason why?

script execution

Good point, but I think it would聽be pretty easy to not allow any <script>, <style>, onclick etc. but only basic聽elements like <b>, <br>, <table>, etc.聽If the markdown parser you're using doesn't provide this,聽sanitize-html is super easy to use.

I still haven't found a complete list of onclick etc attributes...

Instead of blacklisting all聽script execution attributes, you can just whitelist聽safe聽attributes. Normally you don't use that many attributes in HTML in markdown, it's mostly聽basic elements like the ones I mentioned above that could also be represented in markdown.

Would also love it if the documentation field on CompletionItem supported Markdown.

Implemented in the npm node modules as speced in the protocol in a backwards compatible way.

Besides CompletionItem, SignatureHelp can provide Markdown as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixfbecker picture felixfbecker  路  3Comments

andfoy picture andfoy  路  6Comments

lanza picture lanza  路  6Comments

angelozerr picture angelozerr  路  6Comments

svenefftinge picture svenefftinge  路  5Comments