Skip to content

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

@imbant

Description

@imbant

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

Metadata

Metadata

Assignees

Labels

Domain: EditorRelated to the LSP server, editor experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions