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

[lsp] Go to Definition missing getter when property returns callable interface

Open imbant opened this issue 3 weeks ago • 0 comments

VS Code Editor Issue

Extension Version: 0.20251203.1
VS Code Version: 1.106.3
Operating System: Windows 11 Pro 24H2 (Build 26100.7171)

Steps to Reproduce

  1. Create two files as shown below (or clone the minimal reproduction repository)
  2. Open VS Code with TypeScript Go Native enabled
  3. Open index.ts
  4. Place cursor on onDidChangeContent in line 5: documents!.onDidChangeContent()
  5. Execute "Go to Definition" (F12)

index.ts

import { TextDocuments } from "./type";

var documents: TextDocuments;

documents!.onDidChangeContent()
//         ^ Go to Definition here

type.d.ts

export interface Event {
  (): any;
}

export declare class TextDocuments {
  get onDidChangeContent(): Event;
}

Minimal reproduction repository: https://github.com/imbant/ts-go-definition-bug

Issue

Expected Behavior (Strada / JS Language Server)

Image

Returns 2 definition locations:

  1. interface Event callable signature (line 2 in type.d.ts)
  2. get onDidChangeContent() getter definition (line 6 in type.d.ts)

Actual Behavior (TypeScript Go Native)

Returns only 1 definition location:

  1. interface Event callable signature

Missing: The getter get onDidChangeContent(): Event definition

Analysis

The property onDidChangeContent is a getter that returns a callable interface (Event). When the code is documents!.onDidChangeContent():

  • onDidChangeContent accesses the getter
  • () invokes the callable interface returned by the getter

"Go to Definition" should return both:

  1. The callable interface signature being invoked
  2. The getter property that provides this value

imbant avatar Dec 04 '25 02:12 imbant