microsoft / microsoft/language-server-protocol

Support edits for "other files" on completion items

Open
#749 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Like TypeScript, in Dart we have support for auto-importing during completions. However sometimes these imports must go in other files (when you have "part" files, the imports go in the "parent" file).

Right now we can add "additional edits" to a completion item, but only for the current file. Using the normal VS Code API, we attach a command to the completion item that takes the "other file" edits as args, and applies them.

In LSP, the equivalent of this means that our completion item will have a command with args that are the workspace edit, that will be passed from the client back to the server (to execute the command) where the server will then call applyEdits on the client, wait for it to apply the edits and return a response, then response to its request.

It feels a bit clunky for an edit to go from the server, to the client, back to the server, back to the client. It would be nice if completion items could just have workspace edits on them directly.

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 LSP completion items, the existing additional-edits behavior, command arguments, workspace edits, and client/server applyEdits requests. Done means completion items can represent edits in other files directly, avoiding the described server-to-client-to-server round trip while preserving the Dart part-file use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, typescript, vscode
Domain
api, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.