microsoft / microsoft/language-server-protocol

client->server request: Join Lines

Open
#992 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request new request
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

Meta: I am in the process of formalizing protocol extensions, used by rust-analyzer. I will be filing issues for generally useful extensions. Here's the doc where we will document our extensions.

joinLines

Server Capability: { "joinLines": boolean }

This request is send from client to server to handle "Join Lines" editor action.

Method: experimental/JoinLines

Request:

interface JoinLinesParams {
    textDocument: TextDocumentIdentifier,
    /// Currently active selections/cursor offsets.
    /// This is an array to support multiple cursors.
    ranges: Range[],
}

Response:

TextEdit[]
Example
fn main() {
    /*cursor here*/let x = {
        92
    };
}

experimental/joinLines yields (curly braces are automagiacally removed)

fn main() {
    let x = 92;
}
Unresolved Question
  • What is the position of the cursor after joinLines?
    Currently this is left to editor's discretion, but it might be useful to specify on the server via snippets.
    However, it then becomes unclear how it works with multi cursor.

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 with the joinLines specification in this issue and the linked rust-analyzer docs/dev/lsp-extensions.md. Review the request parameters, response type, example transformation, and unresolved cursor-position question. Done means the extension's behavior and cursor semantics are agreed and documented clearly enough for clients and servers to implement.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.