microsoft / microsoft/language-server-protocol

Is `completionItem/resolve` valid after a document change?

Open
#2,060 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarification
Dominant language
TypeScript
Stars
13k
Forks
1k
Avg merge
6d 1h
Merged PRs (30d)
10

Description

As far as I can see, the specification does not explicitly forbid the following sequence:

  1. call textDocument/completion
  2. change the document, send textDocument/didChange
  3. call completionItem/resolve for one of the items returned in step 1.

In rust-analyzer, we made the assumption that completion items would not be possible to resolve after changing the document. It turns out that at least Neovim and Helix seem to change the document while the user cycles through completions, and then try to resolve the outdated completion items though. So the question is, is this a client error or does the server need to support this? If this is intended to be supported, for how long do completion items need to be resolvable? The discussion in #1802 came close to touching upon this, but as far as I see didn't answer it.

https://github.com/rust-lang/rust-analyzer/issues/18547
https://github.com/helix-editor/helix/issues/12119

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

Review the completion and completionItem/resolve sequence described in the issue, then compare it with the discussion in #1802 and the linked rust-analyzer and Helix issues. Determine whether the protocol permits resolving items after didChange, and define the validity period or required client behavior. Done means the specification has an explicit, agreed answer.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.