microsoft / microsoft/language-server-protocol

Code Action Groups

Open
#994 8 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Another general protocol extension poached from rust-analyzer

CodeAction Groups

Client Capability: { "codeActionGroup": boolean }

If this capability is set, CodeAction returned from the server contain an additional field, group:

interface CodeAction {
    title: string;
    group?: string;
    ...
}

All code-actions with the same group should be grouped under single (extendable) entry in lightbulb menu.
The set of actions [ { title: "foo" }, { group: "frobnicate", title: "bar" }, { group: "frobnicate", title: "baz" }] should be rendered as

💡
  +-------------+
  | foo         |
  +-------------+-----+
  | frobnicate >| bar |
  +-------------+-----+
                | baz |
                +-----+

Alternatively, selecting frobnicate could present a user with an additional menu to choose between bar and baz.

Example
fn main() {
    let x: Entry/*cursor here*/ = todo!();
}

Invoking code action at this position will yield two code actions for importing Entry from either collections::HashMap or collection::BTreeMap, grouped under a single "import" group.

Unresolved Questions
  • Is a fixed two-level structure enough?
  • Should we devise a general way to encode custom interaction protocols for GUI refactorings?

group

IntelliJ variation:

import

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 reading the linked rust-analyzer LSP extension reference and the CodeAction capability/interface described in this issue. Done requires agreement on the grouping structure, client interaction, and protocol behavior; the payload names no repository files or tests.

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
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.