Skip to content

On an interface or abstract method I can't get to the code that actually runs; Go to definition stops at the declaration #682

Closed
1 of 1 issue completed

Description

@a-team-app

Opportunity

When I read unfamiliar C#, Go or TypeScript, I often land on a call through an interface or an abstract method, like _store.SaveAsync(...) or a handler that DI wires up. I want to see the code that actually runs. Go to definition (Ctrl+G D) stops at the interface declaration, which has no body. Find usages (Ctrl+G U) lists the callers, not the implementations. So I end up text-searching for the method name or : IStore and picking the real one out of the hits by hand.

In a codebase built on interfaces, this is the hop I make most often, and it's the only one TuiCode's code navigation can't make.

  • VS Code has Go to Implementations (Cmd+F12), and Rider has Go to Implementation (Cmd+Alt+B). Both work on interface and abstract members and on the types themselves.
  • The servers TuiCode offers answer LSP textDocument/implementation: csharp-ls, the Roslyn server, gopls (docs), typescript-language-server and rust-analyzer. pyright and pylsp don't. TuiCode never sends the request today (Languages/LanguageServer.cs sends definition, references, hover and the symbol requests).
  • Go to definition (#454), Find usages (#455), library sources (#610) and Go to type (#653) have all shipped. This pitch reuses their jump and their Definitions of picker.

Options considered

  1. Do nothing. Keep using Find usages or Find globally and pick the right hit by hand. It costs nothing, but the hop stays slow and error-prone, and it's the one interface-heavy code needs most.
  2. Make Go to definition jump past the interface. When the declaration has no body and there's exactly one implementation, gd would go straight there. That saves a key, but it's surprising: sometimes you do want the contract and its doc comment, and then gd would never get you there. It also hides what happened.
  3. List implementations in the Usages tab (Find implementations). The list would stay in the pane. That's good when there are a dozen, but most interfaces in an app have one or two implementations, so it costs a trip to the sidebar and a second Enter for the common case.
  4. A new Go to implementation command that works like Go to definition (chosen). With one answer it jumps. With several it opens the same picker gd uses for a partial class. With none it says so on the status bar. One key covers the common case, the picker handles the rare one, and nothing the user already relies on changes.

Proposal

A new command, Go to implementation (Ctrl+G I, mnemonic gi, in the Go menu beside Go to definition). It's Editor-scoped and works on the name under the cursor:

  • One implementation: jump there, recorded as an explicit jump so Ctrl+G P comes back, and revealed the way gd reveals a jump (unfolding it, below any sticky lines).
  • Several: the Definitions of picker, titled Implementations of IStore.SaveAsync, one row per implementation (File.cs:12 code on that line), filterable. Enter goes to the selected one and Esc leaves the cursor where it was.
  • None: No implementations of SaveAsync on the status bar.
  • On a concrete method or class the server answers with the thing itself (or its overrides and subclasses), so the command still does something sensible.
  • In a library type, answers in referenced assemblies open as read-only decompiled sources, as gd's do.
  • A server that can't answer (it doesn't advertise implementation support, like pyright): Pyright can't find implementations on the status bar, rather than an empty result that looks like there aren't any.
  • With no server, or while it loads, the command says what gd says, and the menu dims it as it dims gd.

Mockup

On _store.SaveAsync(order) with two implementations, Ctrl+G I:

┌ Implementations of IStore.SaveAsync ────────────────────────────┐
│ Filter: [                                                     ] │
│ ▸ SqlStore.cs:48        public async Task SaveAsync(Order o)    │
│   InMemoryStore.cs:21   public Task SaveAsync(Order o)          │
│                                                                 │
│                                [ Go to ]  [ Cancel ]            │
└─────────────────────────────────────────────────────────────────┘

With one implementation there is no dialog: the cursor lands on SqlStore.cs:48, and the status bar shows the usual jump.

Scope

In: the textDocument/implementation request, with the client capability declared. The command, key, mnemonic, menu item and F1 row. Quick info moving to qi and Ctrl+G Q. In the leader, Enter sends a complete mnemonic that starts a longer one, so q Enter runs Quit. The one/several/none behaviour above, including decompiled answers and servers that can't answer.

Out: a type hierarchy view (supertypes and subtypes as a tree). Go to base (the reverse hop). Showing implementation counts inline (code lens). A peek view that shows the code without leaving the file.

Delivery

One PR. It's one request plus a command that reuses gd's jump and picker.

Decided

  • Quick info moves to make room (you, on this pitch). Go to implementation takes gi and Ctrl+G I. Quick info becomes qi, key Ctrl+G Q, Go menu hotkey Q. Its F1 row and the menu's key hint follow. Ctrl+G Q was my pick to match qi; you approved it.
  • Quit stays q, and q Enter quits (you, on this pitch). A mnemonic runs as soon as the keys typed can only mean one command; a complete mnemonic that also starts a longer one waits for Enter. On main Enter only runs the one row still listed, so this PR makes Enter run the complete mnemonic you've typed. The prefix-free test becomes a test that every mnemonic can be reached.
  • Ctrl+G I as the default key (yours, from the register: you, on When I'm in a file, I can't get to it in the explorer to see what sits beside it #648 and I know the type I want but not its file, and nothing finds it by name #649).
  • It jumps on a single answer, with no picker (mine). That's how gd, VS Code and Rider behave.
  • It doesn't appear in Quick info's buttons (mine). That box's bottom border already narrows to fit two buttons.

Original idea

Opportunity

Reading unfamiliar C#, Go or TypeScript, I land on a call through an interface or an abstract method (_store.SaveAsync(...), a handler registered by DI) and want to see the code that actually runs. Go to definition (Ctrl+G D) takes me to the interface declaration, which has no body. Find usages (Ctrl+G U) lists every caller, not the implementations. So I fall back to a text search for the method name, or : IStore, and pick the real one out of the hits by hand.

This is the most common hop when you're trying to understand a codebase built on interfaces, and it's the one hop TuiCode's code navigation doesn't make.

Evidence

  • VS Code has Go to Implementations (Cmd+F12) and Rider has Go to Implementation (Ctrl+Alt+B / Cmd+Alt+B), both on interface and abstract members and on the types themselves.
  • The language servers TuiCode already offers answer it through LSP textDocument/implementation: gopls documents it, and csharp-ls added it. TuiCode sends only definition, references, hover and documentSymbol today (src/TuiCode.Workbench/Languages/LanguageServer.cs).
  • Go to definition (#454), Find usages (#455), library source (#603) and Go to type (#649) have all shipped, so the picker and References tab this needs largely exist.

Why it fits

Theme 3, Code intelligence: "language-aware navigation such as find-usages". The vision's user spends most of their time "navigating code bases ... and trying to understand existing/new code", and interfaces are where text navigation fails them. It is small: one more request to the server they already run, shown the way Go to definition already shows several answers.

Activity

  1. a-team-app commented on Nov 15, 2026

    @a-team-app
    ContributorAuthor

    Recommended: High · theme 3, small · the one navigation hop interface-heavy code needs that Go to definition and Find usages don't make; one more request to servers already running

  2. added
    pitchAn a-team pitch: Lead shapes it, reviewer approves it
    on Nov 17, 2026
  3. a-team-app commented on Nov 17, 2026

    @a-team-app
    ContributorAuthor

    Pitched now: a slot was free. I checked it against main as it is today, with Underline problems (#690) and Go to type (#656) merged, and nothing in it changed. Ctrl+G C and gci are both still free.

  4. jamescrosswell commented on Nov 18, 2026

    @jamescrosswell
    Contributor

    A new command, Go to concrete implementation (Ctrl+G C, mnemonic gci, in the Go menu beside Go to definition). It's Editor-scoped and works on the

    Let's just call it Go to implementation with the mnemonic gi and a binding of Ctrl + G I.

    • The label is Go to concrete implementation, mnemonic gci. Go to implementation would be gi, and Quick info already has that. "Concrete" is the word that's free, and the palette's filter still finds it by "implementation". It's a "Go to" because it jumps (from the register: lead, on I know the type I want but not its file, and nothing finds it by name #649). Comment if you'd rather rename Quick info's mnemonic instead.

    Change quick info to qi and change quit to qt

  5. jamescrosswell commented on Nov 18, 2026

    @jamescrosswell
    Contributor

    Actually, leave the mnemonic for Quit as q... that means someone has to press q Enter to quit.

  6. a-team-app commented on Nov 18, 2026

    @a-team-app
    ContributorAuthor

    Done. The pitch now says:

    • Go to implementation, gi, Ctrl+G I.
    • Quick info moves to qi and Ctrl+G Q. I picked the key to match the mnemonic; say if you'd like another.
    • Quit stays q. Today Enter in the leader only runs the last match left, so q Enter would do nothing while qi exists. The pitch now has Enter run whatever complete mnemonic you've typed. Typing q alone stops quitting at once.

    I've recorded the q/qi pair as a named exception to your prefix-free rule (#237), not a change to it. It's still in Pitched for you to approve.

  7. jamescrosswell commented on Nov 18, 2026

    @jamescrosswell
    Contributor
    • Quit stays q. Today Enter in the leader only runs the last match left, so q Enter would do nothing while qi exists. The pitch now has Enter run whatever complete mnemonic you've typed. Typing q alone stops quitting at once.

    The mnemonics were only ever supposed to trigger if/when the combination of keys that someone pressed could only possibly identify a single command... as long as it was ambiguous, more keys are required. In this case (a mnemonic which has been completely entered, but forms a substring of anothe mnemonic) enter is required to 'send/trigger' the mnemonic. That's always now they were supposed to work... can you ensure this is how they work currently?

  8. a-team-app commented on Nov 18, 2026

    @a-team-app
    ContributorAuthor

    Checked main. Half of it works that way today:

    • Auto-run: yes. A mnemonic runs only once what you've typed is complete and nothing else starts with it. q would wait while qi exists.
    • Enter: no. Enter only runs the single row still listed. With q and qi both listed, q Enter does nothing. This has never shown, because a test forbids any mnemonic from starting another.

    I've changed the pitch so this PR fixes Enter: it runs the complete mnemonic you've typed, even when a longer one starts with it. That test changes to check every mnemonic can be reached.

    I recorded your rule in the register. It replaces the "no mnemonic may be a prefix of another" half of what you said on #237 (26 Sep), and my earlier note on this pitch that treated q/qi as an exception.

    It stays in Pitched for your go-ahead.

  9. a-team-app commented on Nov 19, 2026

    @a-team-app
    ContributorAuthor

    Broken down into one task: #699, Go to implementation (gi, Ctrl+G I), with Quick info's move to qi/Ctrl+G Q and Enter running a complete mnemonic like q.

    It runs alongside #697 (Rename symbol): both add a request to the language server, but they only brush shared files.

    Nothing in Assumed was left for me to settle; I moved it all to Decided.

  10. a-team-app commented on Nov 20, 2026

    @a-team-app
    ContributorAuthor

    Tried on main at d588308 (#701), with csharp-ls on a small C# project. Ctrl+G I on a call to an interface method with two implementations opened Implementations of IStore.Save listing both. On a method with one implementation it jumped straight to it. Closing as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pitchAn a-team pitch: Lead shapes it, reviewer approves it

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions