microsoft / microsoft/language-server-protocol

Provide better guidance on the use of CompletionItem.detail and CompletionItem.documentation

Open
#1,115 19 comments 58 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

There are two fields on CompletionItem for type/docs:

	/**
	 * A human-readable string with additional information
	 * about this item, like type or symbol information.
	 */
	detail?: string;

	/**
	 * A human-readable string that represents a doc-comment.
	 */
	documentation?: string | MarkupContent;

These comments make it seem like detail is a good place to put function signatures, but this seems to not be the case because they appear quite poorly in VS Code (no highlighting - see https://github.com/microsoft/vscode/issues/106862) and the recommendation is to use documentation and leave detail blank.

It's important for servers and clients to all be on the same page to ensure things are rendered well across clients, so I think the LSP spec should have clearer guidance here. For example, if a server puts signature information in detail for VS Code it's important it is not also at the top of documentation. I know LSP doesn't want to get into UI, but if it's just silent on this, clients will behave differently and then servers are stuck picking between "some information not being visible in some editors" and "some information being duplicated in some editors".

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 CompletionItem.detail and CompletionItem.documentation definitions shown in the issue. Review their existing comments and the linked rendering concern, then clarify how type or signature information should be represented without duplication. Done means the specification gives consistent guidance to servers and clients.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.