microsoft / microsoft/TypeScript

Find All References should include composed return value

Open
#58,509 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔍 Search Terms

"Find all References", "find references composable", "find all references returned"

✅ Viability Checklist
⭐ Suggestion

Running 'Find all references' on a Function defined within a function and returned in a composed object, should include references to the function defined on the composed object.

📃 Motivating Example

It's a common practice to compose objects within functions that are exported for use by the program.
For example, using object composition with pinia and vue:

import { defineStore } from "pinia";

export const useMyStore = defineStore('mystore', () => {

	function funcA() { }

	return {
		funcA,
	}

});

However, using 'findAllReferences' on the function defined within the composing function does not detect references through the returned object:

findAllRefs

Using 'findAllReferences' on the function defined on the returned object itself, does return such references:

findAllRefsReturn

💻 Use Cases
  1. When editing a function in a composed store, it is common to check for references to the function being changed.
  2. The references of the function defined within the composable function only returns the references within the store, rather than uses linked by the composed object.
  3. Currently you must scroll from the function being worked on to the composed object, and run 'Find All References' from there. It is a minor inconvenience, but an extremely common one.

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

Reproduce the composed-object example and compare Find All References results for the inner function and the returned property. Start at the Find All References language-service entry point, then identify the relevant reference tests; done means references through the composed return value are included without changing runtime behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.