languageserver icon indicating copy to clipboard operation
languageserver copied to clipboard

completionItem/resolve strips newlines

Open jkroes opened this issue 3 years ago • 3 comments

Here is an example showing the documentation returned for dplyr::select to the Emacs client lsp-mode. Text from different sections and some text that is bulleted (in non-languageserver document viewers) is concatenated without newlines. For Emacs, UI packages that render the documentation for completion items (e.g., company-box) render it as one long string that runs off the edge of the monitor.

[Trace - 06:14:01 PM] Received response 'completionItem/resolve - (396)' in 53ms.
Result: {
  "documentation": {
    "value": " Select (and optionally rename) variables in a data frame, using a concise mini-language that makes it easy to refer to variables based on their name (e.g. `a:f` selects all columns from `a` on the left to `f` on the right). You can also use predicate functions like is.numeric to select variables based on their properties. Overview of selection features   Tidyverse selections implement a dialect of R where operators make it easy to select variables:   `:` for selecting a range of consecutive variables.  `!` for taking the complement of a set of variables.  `&` and `|` for selecting the intersection or the union of two sets of variables.  `c()` for combining selections.   In addition, you can use selection helpers . Some helpers select specific columns:   `everything()` : Matches all variables.  `last_col()` : Select last variable, possibly with an offset.   These helpers select variables by matching patterns in their names:   `starts_with()` : Starts with a prefix.  `ends_with()` : Ends with a suffix.  `contains()` : Contains a literal string.  `matches()` : Matches a regular expression.  `num_range()` : Matches a numerical range like x01, x02, x03.   These helpers select variables from a character vector:   `all_of()` : Matches variable names in a character vector. All names must be present, otherwise an out-of-bounds error is thrown.  `any_of()` : Same as `all_of()` , except that no error is thrown for names that don't exist.   This helper selects variables with a function:   `where()` : Applies a function to all variables and selects those for which the function returns `TRUE` .  ",
    "kind": "markdown"
  },
  "_emacsStartPoint": 163,
  "insertTextFormat": 2,
  "insertText": "select($0)",
  "sortText": "4-select",
  "detail": "{dplyr}",
  "kind": 3,
  "label": "select"
}

jkroes avatar Feb 22 '22 02:02 jkroes

Hi, I'm having the same issue with not being able to read the text as it spans across one very long line only in Emacs (ESS specifically).

Here's a visual example of the issue described by @jkroes: image

davidbudzynski avatar May 29 '22 18:05 davidbudzynski

Does your editor support markdown documentation?

renkun-ken avatar May 30 '22 01:05 renkun-ken

Not sure what do you mean. The screenshot is showing Emacs 28.1 so I guess this should be supported. This is a problem only when using lsp in R. I do not have this problem when using Python or Ruby. This is an example from Ruby: image

davidbudzynski avatar May 30 '22 11:05 davidbudzynski