REditorSupport / REditorSupport/languageserver

completionItem/resolve strips newlines

Open
#527 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
675
Forks
118
Avg merge
1d 37m
Merged PRs (30d)
11

Description

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"
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the completionItem/resolve handling that produces the documentation value in the shown response, then check how markdown content is assembled before it is returned to the Emacs client. Done means section and bullet boundaries retain newlines in the resolved documentation while remaining valid for the language-server protocol.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.