microsoft / microsoft/TypeScript

TSServer: Find all reference for per overloaded function type

Open
#32,989 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: LS: Refactorings Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms

Find references, overload, function, overloaded function

Suggestion

Provide a mechanism to search references of a function with particular overloaded type

Use Cases

In current implementation find all references for overloaded function shows all references for every overload
Some times we need to find references of particular overload only (i.e. a overload is deprecated and we want to update all use cases)

Examples

/**
 * @deprecated
 **/
declare function fn():void; // overload 1
declare function fn(param:string):number; // overload  2

fn(); // use 1

const x = fn('a'); // use 2
const y = fn('b'); // use 3

Finding references for overload 1 should list use 1.
Finding references for overload 2 should list use 2 and use 3.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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.

Research direction

Start by investigating TSServer's find-references behavior for overloaded functions and how it identifies a selected overload. Define completion against the examples: references for overload 1 include only use 1, while overload 2 includes use 2 and use 3.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.