microsoft / microsoft/debug-adapter-protocol

Modify or clarify the CompletionItem description to match de facto usage

Open
#138 1 comment 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

clarification
Dominant language
HTML
Stars
1.8k
Forks
173
Avg merge
7d 7h
Merged PRs (30d)
2

Description

I'm implementing completion in my client, and after testing a bunch of servers have found that the de facto implementation of the DAP client does not seem to match the spec, meaning that just implementing the spec leads to it not working properly.

The spec seems pretty clear that if the start property is not supplied, then the text should be inserted at the position completion was requested:

  • If missing the text is added at the location specified by the CompletionsRequest's 'column' attribute.

However, in my testing I have found 3 classes of behaviour:

  1. start and length are supplied. start is reliable (https://github.com/microsoft/debugpy)
  2. neither start nor length are supplied. The server seems to assume that client will magically decide the completion starts at the beginning for the current word (however that is defined) (https://github.com/microsoft/vscode-node-debug)
  3. start is supplied, but length is not. start is unreliable (https://github.com/microsoft/vscode-java-debug)

Specific example of 2.: https://github.com/puremourning/vimspector/issues/245#issuecomment-686793337

I believe this is the VSCode code that handles DAP completion items: https://github.com/microsoft/vscode/blob/6f223f2823ae66a2399ee3b03ffaea8fcad393e5/src/vs/workbench/contrib/debug/browser/repl.ts#L156-L177

In particular the overwriteBefore behaviour seems to be incorrect WRT to the current specification. I realise that I could report this as a VScode bug, but my guess is that it's actually a specification error, on the basis that the majority of servers seem to fall in the category of not supplying start/length, but (presumably) working in VScode.

Assuming I understood all of that correctly, could we either:

  • confirm that the spec is correct and VSCode and most servers are wrong, or
  • update the spec to be clear about what clients should do with CompletionItem

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.