microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
912 stars 131 forks source link

Render LaTeX math in intellisense documentation #1880

Open nihirv opened 4 years ago

nihirv commented 4 years ago

I work a lot with deep learning frameworks, which obviously have a lot of mathematical equations in them (written in Latex). It'd be useful to have these equations rendered as Latex would instead of the Latex strings themselves

image

IanMatthewHuff commented 4 years ago

@nihirv Thanks for the report on this. I can see the issue with that.

@brettcannon I was thinking this might be a core team issue since it's general intellisense, but I'm not even sure about that. Perhaps all the way up to the VSCode level? I believe that our only current options are markdown and text in the popups.

karthiknadig commented 4 years ago

@nihirv Can you tell me what you have for the jediEnabled setting?

nihirv commented 4 years ago

@karthiknadig In the original screenshot, jediEnabled was at its default value: true. I turned it off to see what would happen. With it set it false, it gets about halfway to the 'ideal' formatting (see screenshot). Interestingly, the documentation seems to cut off early. Unsure if this is because of .. math:: or because of a character limit

N.B. This a screenshot of the same method as the original screenshot. Notice how it cuts of after "where". image

karthiknadig commented 4 years ago

@nihirv for issue you see when using jedi, you will have to file it in their repo. https://github.com/davidhalter/jedi.

I am moving this to Language server since the partial help comes from LS.

jakebailey commented 4 years ago

The language server protocol only allows for plaintext or markdown. Without markdown support for LaTeX characters, I'm not entirely certain how this would be implemented. I think you can have HTML directly in Markdown, but I'm unsure if that's allowed within tooltips (and would probably mean having to MathJAX stuff; I don't have experience trying to run JS in tooltips, let alone raw HTML).

The chopping off after "where" is probably our docstring conversion. That docstring is in ReST which has a lot of different features, I believe I have it set up to ignore certain elements which could be including .. math::. It's not a character limit; VS Code happily renders huge tooltips with scrollbars.

nihirv commented 4 years ago

What's wrong with having markdown support for Latex characters?