typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Fix references code lens to include imports as references

Open Copilot opened this issue 2 weeks ago • 1 comments

  • [x] Understand the issue: References code lens does not include imports as references
  • [x] Create a fourslash test for this issue
  • [x] Attempted fix but it caused regressions (doubled ranges, goToImplementation failures)
  • [x] Reverted incorrect fix per reviewer feedback - changes need to be based on original TypeScript implementation

Status

The fourslash test codeLensReferencesIncludeImports_test.go is kept to demonstrate the issue. The baseline shows 0 references which is the current (incorrect) behavior.

A proper fix requires more careful analysis of how TypeScript handles the difference between isDefinition marking vs Go's per-entry declaration filtering.

Original prompt

This section details on the original issue you should resolve

<issue_title>References code lens does not include imports as references</issue_title> <issue_description>For a project:

// abc.ts
export function abc() { }
// other.ts
import { abc } from "./abc";

The references code lens currently shows 0 references

I can understand why it's doing this but it also feels a bit unexpected. TS 6.0 includes the imports as references</issue_description>

<agent_instructions>Create a fourslash test for this, based on internal/fourslash/tests/codeLensShowOnAllFunctions_test.go, Run all tests, accept the baselines, and commit that. Then work on the issue.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

  • Fixes microsoft/typescript-go#2367

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Dec 12 '25 20:12 Copilot

@copilot whatever you add, make sure it actually has a basis in the original implementation, and not something made up

Reverted the incorrect fix in commit aaefcb7a. The test is kept to demonstrate the issue, but the baseline now shows the current behavior (0 references). A proper fix requires more careful analysis of how TypeScript handles isDefinition marking vs Go's per-entry declaration filtering.

Copilot avatar Dec 12 '25 22:12 Copilot