lite-xl-lsp icon indicating copy to clipboard operation
lite-xl-lsp copied to clipboard

Discussion regarding the lsp

Open VarLad opened this issue 4 years ago • 14 comments
trafficstars

It's a common problem in almost every other text editor to display the docs. Because the docs are mostly md, and editors are mostly not made in Electron

A good solution I can think of is to not display the docs with autocomplete/suggestions. Instead, make a separate docs pane, where user can search keywords. The docs pane can also display the docs of the word the pointer is pointing to, in the editor. As for the docs pane, using something like https://github.com/Orange-OpenSource/pandoc-terminal-writer to render the md and display the docs is an idea. Another idea can be to write (something like) https://github.com/ttscoff/mdless in Lua Either way, I think this should be the future for lsp support in lite-xl, which is worth looking into after the lsp implementation is complete

VarLad avatar Jun 24 '21 16:06 VarLad

The doc pane sounds like a good option to have (maybe display it at the bottom of the editor view), but I would still prefer to have rapid access to docs on the selected autocomplete item side by side without affecting the whole document view.

As for the docs pane, using something like https://github.com/Orange-OpenSource/pandoc-terminal-writer to render the md

Implementing a markdown renderer in lite should be possible and maybe not too difficult and it could be used on the description tooltip (or documentation pane if implemented)

Another idea can be to write (something like) https://github.com/ttscoff/mdless in Lua

That would be the quickest solution, to convert the markdown to plaintext, all we would need is a strip_markdown(text) function until a proper markdown renderer is written.

jgmdev avatar Jun 24 '21 17:06 jgmdev

maybe display it at the bottom of the editor view

Yeah, many editors employ this and it works Also, we can give an option to switch as well between live and in the pane. My main concern being, I've seen the docs consume the entire program space making it really annoying. With a pane at the bottom, we can have a scroll bar as well. Also, having the pane gives us better options over the md display and the opportunity to make a docs-search bar where users can search for docs of a specific function without the autocomplete. Also, making the pane hide/unhide is a good option so users can just hide it when they only want autocomplete and no docs. Default behavior can be to display the docs of the keyword the cursor is currently at if its found.

VarLad avatar Jun 24 '21 20:06 VarLad

I've seen the docs consume the entire program space making it really annoying.

True, really bad on long documentation comments, perhaps also implement a scrollable tooltip, but now that you mention this the pane makes more sense and if done using the docview api may be easier to do, maybe also add a button to tooltip that says "view more" and opens the pane.

jgmdev avatar Jun 24 '21 20:06 jgmdev

For the moment I implemented a basic markdown to plain text function and this is the result:

Before: 2021-06-25_02:15:57

After: 2021-06-25_02:12:44

So until a proper markdown renderer is implemented this will do.

jgmdev avatar Jun 25 '21 06:06 jgmdev

Leaving this here for reference https://github.com/jgm/lunamark

jgmdev avatar Jun 25 '21 07:06 jgmdev

Any way we can get code highlighting here? Stuff like bold and italics

VarLad avatar Jun 25 '21 16:06 VarLad

Any way we can get code highlighting here? Stuff like bold and italics

Yeah, it is possible, but first we would need for lite to support that and there is discussion about implementing support for italic and bold fonts using the agg library.

With current lite-xl functionality one could implement a syntax highlighter every time that code sections are found as change the color and size of text depending on the kind of markdown element it is, but that requires using a proper markdown parser like the one shared above and a description popup with better encapsulated functionality as maybe what described on lite-xl overlay system

For the moment I will focus on the more easy things like:

  • Accent active parameter and signature
  • Be able to search workspace symbols 'workspace/symbol'
  • Add symbol renaming support 'textDocument/rename'
  • etc...

jgmdev avatar Jun 25 '21 21:06 jgmdev

FWIW I'm currently using qtcreator, which uses both docs in suggestions and has a documentation pane. To me the "brief" documentation in suggestions is enough, usually I read the documentation in a separate context (local or website documentation) only when needed.

redtide avatar Jul 26 '21 08:07 redtide

@redtide The documentation pane would help in not opening a browser Also, we can search docs with a pane without suggestions

Again, I think, a pane should be implemented, with an option to switch between docs in suggestions and docs in a pane

VarLad avatar Jul 26 '21 08:07 VarLad

@jgmdev If possible, can you implement the pane for now? We can work on pretty printing of markdown later

VarLad avatar Jul 26 '21 08:07 VarLad

I didn't mean to exclude the doc pane, but having also the brief information of a function in suggestions, so not forcing people to open a pane.

redtide avatar Jul 26 '21 08:07 redtide

The pane must have a separate search bar And hovering upon the suggestions from autocomplete should display docs in the pane as well

VarLad avatar Jul 26 '21 08:07 VarLad

Also, @redtide @jgmdev Anyway we can get highlighting from liteXL into the docs?

VarLad avatar Jul 26 '21 08:07 VarLad

I'm not working on this, just an user like you.

redtide avatar Jul 26 '21 09:07 redtide

Mouse hover is implemented and just pushed a change to allow opening a symbol hover information on a separate pane when pressing alt+shift+a or by executing lsp:show-symbol-info-in-tab or right clicking and selection it from context menu:

lsp-help-tab

Since it is just a read only docview it should allow searching, scrolling, etc...

jgmdev avatar Oct 25 '22 06:10 jgmdev