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 140 forks source link

Sideline displays full info, including docs #292

Open infinisil opened 5 years ago

infinisil commented 5 years ago

lsp-ui-sideline displays way too long lines, apparently trying to include the full text, the same as it shows in lsp-ui-doc:

I'm using

Here are the full logs of the server:

```log 2019-06-02 16:17:28.327343854 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":69}},"id":254} 2019-06-02 16:17:28.327546112 [ThreadId 10] - ****** reactor: got message number:255 2019-06-02 16:17:28.327611512 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 254, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 69}}} 2019-06-02 16:17:28.327672639 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.327721332 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.327761292 [ThreadId 13] - ideDispatcher: got request 255 with id: IdInt 254 2019-06-02 16:17:28.341887392 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.342196928 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nreturn :: () -> IO ()\n```\n```haskell\nreturn :: forall (m :: * -> *) a. Monad m => a -> m a\n```\n\n\nInject a value into the monadic type.\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/Control-Monad.html#v:return)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/GHC-Base.html#return)\n\nbase GHC.Base"},"range":{"start":{"line":101,"character":69},"end":{"line":101,"character":75}}},"jsonrpc":"2.0","id":254} 2019-06-02 16:17:28.539296782 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"range":{"start":{"line":101,"character":0},"end":{"line":101,"character":77}},"context":{"diagnostics":[]}},"id":255} 2019-06-02 16:17:28.539596167 [ThreadId 10] - ****** reactor: got message number:256 2019-06-02 16:17:28.539727011 [ThreadId 10] - reactor:got CodeActionRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 255, _method = TextDocumentCodeAction, _params = CodeActionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _range = Range {_start = Position {_line = 101, _character = 0}, _end = Position {_line = 101, _character = 77}}, _context = CodeActionContext {_diagnostics = List [], only = Nothing}}} 2019-06-02 16:17:28.539874405 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.54001468 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.540182617 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.540299838 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.540412809 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.540513261 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.540620901 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.54071974 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.541036867 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.541096782 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.541153467 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.54120056 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.541251985 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.54130272 [ThreadId 13] - ideDispatcher: got request 256 with id: IdInt 255 2019-06-02 16:17:28.541358185 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.541461568 [ThreadId 6] - <--2--{"result":[],"jsonrpc":"2.0","id":255} 2019-06-02 16:17:28.54187672 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":4}},"id":256} 2019-06-02 16:17:28.542023467 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":17}},"id":257} 2019-06-02 16:17:28.542221245 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":22}},"id":258} 2019-06-02 16:17:28.542337413 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":25}},"id":259} 2019-06-02 16:17:28.542446012 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":30}},"id":260} 2019-06-02 16:17:28.542626026 [ThreadId 10] - ****** reactor: got message number:257 2019-06-02 16:17:28.54267999 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 256, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 4}}} 2019-06-02 16:17:28.5427373 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.542776451 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.542812042 [ThreadId 10] - ****** reactor: got message number:258 2019-06-02 16:17:28.542846128 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 257, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 17}}} 2019-06-02 16:17:28.542893499 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.542939295 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.542973196 [ThreadId 10] - ****** reactor: got message number:259 2019-06-02 16:17:28.543005832 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 258, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 22}}} 2019-06-02 16:17:28.543046604 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.543081574 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.543114546 [ThreadId 10] - ****** reactor: got message number:260 2019-06-02 16:17:28.543147209 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 259, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 25}}} 2019-06-02 16:17:28.543187324 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.543222301 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.543255208 [ThreadId 10] - ****** reactor: got message number:261 2019-06-02 16:17:28.543288141 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 260, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 30}}} 2019-06-02 16:17:28.543328715 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.543363467 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.543400634 [ThreadId 13] - ideDispatcher: got request 257 with id: IdInt 256 2019-06-02 16:17:28.545315724 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":42}},"id":261} 2019-06-02 16:17:28.545471571 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":47}},"id":262} 2019-06-02 16:17:28.545700364 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":55}},"id":263} 2019-06-02 16:17:28.545846848 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":60}},"id":264} 2019-06-02 16:17:28.546083764 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":69}},"id":265} 2019-06-02 16:17:28.546228967 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":69}},"id":266} 2019-06-02 16:17:28.560430055 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.560527926 [ThreadId 13] - ideDispatcher: got request 258 with id: IdInt 257 2019-06-02 16:17:28.561017372 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.561065607 [ThreadId 13] - ideDispatcher: got request 259 with id: IdInt 258 2019-06-02 16:17:28.561326754 [ThreadId 10] - ****** reactor: got message number:262 2019-06-02 16:17:28.561376503 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 261, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 42}}} 2019-06-02 16:17:28.561453272 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.561511965 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.56156588 [ThreadId 10] - ****** reactor: got message number:263 2019-06-02 16:17:28.561623489 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 262, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 47}}} 2019-06-02 16:17:28.561702479 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.56176676 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.561825458 [ThreadId 10] - ****** reactor: got message number:264 2019-06-02 16:17:28.561908009 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 263, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 55}}} 2019-06-02 16:17:28.561956845 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.561997351 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.562026707 [ThreadId 10] - ****** reactor: got message number:265 2019-06-02 16:17:28.562064544 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 264, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 60}}} 2019-06-02 16:17:28.562104168 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.562136526 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.562167351 [ThreadId 10] - ****** reactor: got message number:266 2019-06-02 16:17:28.562198734 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 265, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 69}}} 2019-06-02 16:17:28.562239001 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.562271444 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.56230299 [ThreadId 10] - ****** reactor: got message number:267 2019-06-02 16:17:28.562334687 [ThreadId 10] - reactor:got DocumentHighlightsRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 266, _method = TextDocumentDocumentHighlight, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 69}}} 2019-06-02 16:17:28.562376586 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.562847012 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.562914459 [ThreadId 13] - ideDispatcher: got request 260 with id: IdInt 259 2019-06-02 16:17:28.563046864 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nhandleJust :: (ExitCode -> Maybe ()) -> (() -> IO ()) -> IO () -> IO ()\n```\n```haskell\nhandleJust :: forall e b a.\nException e =>\n(e -> Maybe b) -> (b -> IO a) -> IO a -> IO a\n```\n\n\nA version of `catchJust` with the arguments swapped around (see\n `handle`).\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/Control-Exception-Base.html#v:handleJust)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/Control-Exception-Base.html#handleJust)\n\nbase Control.Exception.Base"},"range":{"start":{"line":101,"character":4},"end":{"line":101,"character":14}}},"jsonrpc":"2.0","id":256} 2019-06-02 16:17:28.563416849 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\ne :: ExitCode\n```\n`e` *local*"},"range":{"start":{"line":101,"character":17},"end":{"line":101,"character":18}}},"jsonrpc":"2.0","id":257} 2019-06-02 16:17:28.563563447 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\n_ :: ExitCode -> Maybe ()\n```\n"},"range":{"start":{"line":101,"character":16},"end":{"line":101,"character":67}}},"jsonrpc":"2.0","id":258} 2019-06-02 16:17:28.563701991 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.563750706 [ThreadId 13] - ideDispatcher: got request 261 with id: IdInt 260 2019-06-02 16:17:28.56407116 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\ne :: ExitCode\n```\n`e` *local*"},"range":{"start":{"line":101,"character":25},"end":{"line":101,"character":26}}},"jsonrpc":"2.0","id":259} 2019-06-02 16:17:28.578411519 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.578509149 [ThreadId 13] - ideDispatcher: got request 262 with id: IdInt 261 2019-06-02 16:17:28.578979701 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.579020445 [ThreadId 13] - ideDispatcher: got request 263 with id: IdInt 262 2019-06-02 16:17:28.579453778 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nExitSuccess :: ExitCode\n```\n```haskell\nExitSuccess :: ExitCode\n```\n\n\nindicates successful termination;\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/System-Exit.html#v:ExitSuccess)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/GHC-IO-Exception.html#ExitSuccess)\n\nbase GHC.IO.Exception"},"range":{"start":{"line":101,"character":30},"end":{"line":101,"character":41}}},"jsonrpc":"2.0","id":260} 2019-06-02 16:17:28.582065775 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\n_ :: ExitCode -> Maybe ()\n```\n"},"range":{"start":{"line":101,"character":16},"end":{"line":101,"character":67}}},"jsonrpc":"2.0","id":261} 2019-06-02 16:17:28.59428131 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.594394946 [ThreadId 13] - ideDispatcher: got request 264 with id: IdInt 263 2019-06-02 16:17:28.594714515 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nJust :: () -> Maybe ()\n```\n```haskell\nJust :: forall a. a -> Maybe a\n```\n\n\n\nbase GHC.Maybe"},"range":{"start":{"line":101,"character":47},"end":{"line":101,"character":51}}},"jsonrpc":"2.0","id":262} 2019-06-02 16:17:28.59528994 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.595348714 [ThreadId 13] - ideDispatcher: got request 265 with id: IdInt 264 2019-06-02 16:17:28.595541962 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\n_ :: ExitCode -> Maybe ()\n```\n"},"range":{"start":{"line":101,"character":16},"end":{"line":101,"character":67}}},"jsonrpc":"2.0","id":263} 2019-06-02 16:17:28.609099297 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.609201863 [ThreadId 13] - ideDispatcher: got request 266 with id: IdInt 265 2019-06-02 16:17:28.624094291 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.624193099 [ThreadId 13] - ideDispatcher: got request 267 with id: IdInt 266 2019-06-02 16:17:28.624507604 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nNothing :: Maybe ()\n```\n```haskell\nNothing :: forall a. Maybe a\n```\n\n\n\nbase GHC.Maybe"},"range":{"start":{"line":101,"character":60},"end":{"line":101,"character":67}}},"jsonrpc":"2.0","id":264} 2019-06-02 16:17:28.624738939 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nreturn :: () -> IO ()\n```\n```haskell\nreturn :: forall (m :: * -> *) a. Monad m => a -> m a\n```\n\n\nInject a value into the monadic type.\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/Control-Monad.html#v:return)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/GHC-Base.html#return)\n\nbase GHC.Base"},"range":{"start":{"line":101,"character":69},"end":{"line":101,"character":75}}},"jsonrpc":"2.0","id":265} 2019-06-02 16:17:28.625008828 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.625144419 [ThreadId 6] - <--2--{"result":[{"kind":2,"range":{"start":{"line":271,"character":2},"end":{"line":271,"character":8}}},{"kind":2,"range":{"start":{"line":269,"character":4},"end":{"line":269,"character":10}}},{"kind":2,"range":{"start":{"line":258,"character":2},"end":{"line":258,"character":8}}},{"kind":2,"range":{"start":{"line":195,"character":2},"end":{"line":195,"character":8}}},{"kind":2,"range":{"start":{"line":193,"character":8},"end":{"line":193,"character":14}}},{"kind":2,"range":{"start":{"line":179,"character":11},"end":{"line":179,"character":17}}},{"kind":2,"range":{"start":{"line":171,"character":2},"end":{"line":171,"character":8}}},{"kind":2,"range":{"start":{"line":169,"character":4},"end":{"line":169,"character":10}}},{"kind":2,"range":{"start":{"line":161,"character":2},"end":{"line":161,"character":8}}},{"kind":2,"range":{"start":{"line":159,"character":6},"end":{"line":159,"character":12}}},{"kind":2,"range":{"start":{"line":142,"character":4},"end":{"line":142,"character":10}}},{"kind":2,"range":{"start":{"line":101,"character":69},"end":{"line":101,"character":75}}},{"kind":2,"range":{"start":{"line":89,"character":14},"end":{"line":89,"character":20}}},{"kind":2,"range":{"start":{"line":81,"character":2},"end":{"line":81,"character":8}}}],"jsonrpc":"2.0","id":266} 2019-06-02 16:17:28.831055865 [ThreadId 4] - ---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":69}},"id":267} 2019-06-02 16:17:28.831296555 [ThreadId 10] - ****** reactor: got message number:268 2019-06-02 16:17:28.831396745 [ThreadId 10] - reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 267, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 69}}} 2019-06-02 16:17:28.831846003 [ThreadId 10] - reactor:HoverRequest done 2019-06-02 16:17:28.831933973 [ThreadId 10] - ****** reactor: top of loop 2019-06-02 16:17:28.832005168 [ThreadId 13] - ideDispatcher: got request 268 with id: IdInt 267 2019-06-02 16:17:28.851560964 [ThreadId 13] - ideDispatcher: top of loop 2019-06-02 16:17:28.851909821 [ThreadId 6] - <--2--{"result":{"contents":{"kind":"markdown","value":"\n```haskell\nreturn :: () -> IO ()\n```\n```haskell\nreturn :: forall (m :: * -> *) a. Monad m => a -> m a\n```\n\n\nInject a value into the monadic type.\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/Control-Monad.html#v:return)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/GHC-Base.html#return)\n\nbase GHC.Base"},"range":{"start":{"line":101,"character":69},"end":{"line":101,"character":75}}},"jsonrpc":"2.0","id":267} ```

Here's the request/response pair for the return:

---> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/infinisil/prj/all-hies/src/Main.hs"},"position":{"line":101,"character":69}},"id":254}
reactor:got HoverRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 254, _method = TextDocumentHover, _params = TextDocumentPositionParams {_textDocument = TextDocumentIdentifier {_uri = Uri {getUri = "file:///home/infinisil/prj/all-hies/src/Main.hs"}}, _position = Position {_line = 101, _character = 69}}}
<--2--{
  "result": {
    "contents": {
      "kind": "markdown",
      "value": "\n```haskell\nreturn :: () -> IO ()\n```\n```haskell\nreturn :: forall (m :: * -> *) a. Monad m => a -> m a\n```\n\n\nInject a value into the monadic type.\n\n\n\n[Documentation](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/Control-Monad.html#v:return)\n\n[Source](file:///nix/store/my4ladhk9nwz28lgv25va5ksq9613qva-ghc-8.6.4-doc/share/doc/ghc/html/libraries/base-4.12.0.0/src/GHC-Base.html#return)\n\nbase GHC.Base"
    },
    "range": {
      "start": {
        "line": 101,
        "character": 69
      },
      "end": {
        "line": 101,
        "character": 75
      }
    }
  },
  "jsonrpc": "2.0",
  "id": 254
}

https://github.com/emacs-lsp/lsp-ui/pull/264 seems to be relevant.

Ping @yyoncho @alanz

yyoncho commented 5 years ago

Generally, onHover request is not designed for what we are trying to use it for(sideline) and it does not offer good experience for some of the servers. There are 3 possibilities:

  1. Change the server to list the info in different format, here it is what JDT LS returns on hover:
[Trace - 05:44:37 PM] Received response 'textDocument/hover - (582)' in 46ms.
Result: {
  "contents": [
    {
      "value": "java.lang.System",
      "language": "java"
    },
    "The `System` class contains several useful class fields and methods. It cannot be instantiated. Among the facilities provided by the `System` class are standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.\n\n *  **Since:**\n    \n     *  1.0"
  ]
}
  1. Change lsp-ui to try to extract the symbol info from the markdown similar to what was tried in https://github.com/emacs-lsp/lsp-mode/pull/779

  2. Close the issue as wont fix and document that it does not work with some of the servers and eventually disable the symbols info by default.

infinisil commented 5 years ago

I see, I think 2 is the most promising. By first rendering the full contents (with lsp--render-element) and then cutting off everything but the first line of that result. Is that possible at all? I've never written any elisp and I can barely read it, so I'm having kind of a hard time with this.

alanz commented 5 years ago

We used to return the MarkedString format for hover, but according to the spec it has been deprecated.

Where MarkedString is defined as follows:

/**
 * 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. The language identifier
 * is semantically equal to the optional language identifier in fenced code blocks in GitHub
 * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
 *
 * The pair of a language and a value is an equivalent to markdown:
 * ```${language}
 * ${value}
 * ```
 *
 * Note that markdown strings will be sanitized - that means html will be escaped.
* @deprecated use MarkupContent instead.
*/
type MarkedString = string | { language: string; value: string };

So this will have to be fixed properly some time.