microsoft / microsoft/language-server-protocol

Add "type" to textDocument/references results

Open
#763 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

VS Code issue (UI) is at https://github.com/microsoft/vscode/issues/74237

The C/C++ extension wants to be able to send back references of different types that users can determine what "type" of reference it is and filter out unwanted types -- in order to provide functionality equivalent to Visual Studio 2019. The types we want are below. Feel free to change the naming of the example types.

  1. Confirmed reference (i.e. passes semantic checking): e.g. Type.ConfirmedReference
  2. Not a reference (i.e. has the same name, but fails semantic checking -- these non-references might be desired in some cases), e.g. e.g. Type.NotAReference
  3. Reference in a comment, e.g. e.g. Type.CommentReference
  4. Reference in a string, e.g. Type.StringReference
  5. Reference in an inactive (preprocessor) region, e.g. Type.InactiveReference (Note: Comment/String references take precedence, so this only applies to identifiers).
  6. Confirmation in progress, e.g. Type.PendingReference
  7. Cannot confirm reference (due to some bug or "by design" limitation), e.g. Type.UnknownReference

It's possible other reference types might be desirable as well for other languages or scenarios.

This is the screenshot from VS:

image

Our current "workaround" is to either send back multiple "types" merged together (ambiguously) or allow users to filter out types via a setting or a progress UI button, e.g. "show confirmed references", "show unconfirmed references" (i.e. 6 and 7).

The relevant LSP that would need to be changed is at
https://microsoft.github.io/language-server-protocol/specification#textDocument_references

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 textDocument/references section of the Language Server Protocol specification linked in the issue and compare the current result shape with the requested reference categories. Done means agreeing on an extensible type representation and documenting the updated protocol behavior, including how clients can distinguish the proposed reference kinds.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.