Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix Go to Definition for getters returning callable interfaces#2210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-go-to-definition-issue

Conversation

Copy link
Contributor

CopilotAI commentedDec 4, 2025
edited
Loading

Go to Definition on a getter that returns a callable interface (e.g.,documents.onDidChangeContent()) was only showing the call signature, not the getter itself.

interfaceEvent<T>{(listener:(e:T)=>any):Disposable;}classTextDocuments{getonDidChangeContent():Event<TextDocumentChangeEvent>;}// F12 on onDidChangeContent here should show both the Event call signature// AND the getter declarationdocuments.onDidChangeContent();

Changes

  • Modifiedinternal/ls/definition.go to preserve accessor declarations when resolving call signatures
  • Previously filtered out all function-like declarations; now keeps getters/setters as they indicate the value's origin
  • Added fourslash test verifying both definitions appear

Technical Detail

When a call signature is resolved, the existing logic removed all function-like declarations via!ast.IsFunctionLike(node). SinceKindGetAccessor is function-like, getters were incorrectly filtered. The fix adds|| ast.IsAccessor(node) to the predicate.

Original prompt

This section details on the original issue you should resolve

<issue_title>[lsp] Go to Definition missing getter when property returns callable interface</issue_title>
<issue_description>## 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. Openindex.ts
  4. Place cursor ononDidChangeContent in line 5:documents!.onDidChangeContent()
  5. Execute "Go to Definition" (F12)

index.ts

import{TextDocuments}from"./type";vardocuments:TextDocuments;documents!.onDidChangeContent()//         ^ Go to Definition here

type.d.ts

exportinterfaceEvent{():any;}exportdeclareclassTextDocuments{getonDidChangeContent():Event;}

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

Issue

Expected Behavior (Strada / JS Language Server)

Image

Returns2 definition locations:

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

Actual Behavior (TypeScript Go Native)

Returns only1 definition location:

  1. interface Event callable signature

Missing: The getterget onDidChangeContent(): Event definition

Analysis

The propertyonDidChangeContent is agetter that returns acallable interface (Event). When the code isdocuments!.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</issue_description>

<agent_instructions>index.ts contains:

import{TextDocument,TextDocuments}from"./type";vardocuments:TextDocuments<TextDocument>;documents!.onDidChangeContent()

types.d.ts contains

exportinterfaceDisposable{/**   * Dispose this object.   */dispose():void;}exportinterfaceEvent<T>{/**   *   *@param listener The listener function will be called when the event happens.   *@param thisArgs The 'this' which will be used when calling the event listener.   *@param disposables An array to which a {{IDisposable}} will be added.   *@return   */(listener:(e:T)=>any,thisArgs?:any,disposables?:Disposable[]):Disposable;}exportinterfaceTextDocumentChangeEvent<T>{/**   * The document that has changed.   */document:T;}exportdeclareclassTextDocuments<Textends{uri:string;}>{getonDidChangeContent():Event<TextDocumentChangeEvent<T>>;}exportinterfaceTextDocument{uri:string;}

Create a fourslash test for this first, then work on the issue</agent_instructions>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

CopilotAIand others added3 commitsDecember 4, 2025 02:57
…interfaceCo-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
… interfaceCo-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
CopilotAI changed the title[WIP] Fix Go to Definition missing getter for callable interfaceFix Go to Definition for getters returning callable interfacesDec 4, 2025
CopilotAI requested a review fromjakebaileyDecember 4, 2025 03:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jakebaileyjakebaileyAwaiting requested review from jakebailey

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

2 participants

@jakebailey

[8]ページ先頭

©2009-2025 Movatter.jp