Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jump to implementation from interface/trait #7721

Open
1 task done
goldenratio opened this issue Feb 13, 2024 · 4 comments
Open
1 task done

Jump to implementation from interface/trait #7721

goldenratio opened this issue Feb 13, 2024 · 4 comments
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] workspace Feedback for workspace management, layout, interactions, etc

Comments

@goldenratio
Copy link

goldenratio commented Feb 13, 2024

Check for existing issues

  • Completed

Describe the feature

in IntelliJ we can easily jump to implementation class, structs, methods, etc..
It will be useful to have similar feature in zed as well.

If applicable, add mockups / screenshots to help present your vision of the feature

image

and If interface has multiple implementation, a nice clean dropdown will be good

image

No response

@goldenratio goldenratio added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Feb 13, 2024
@JosephTLyons JosephTLyons added workspace Feedback for workspace management, layout, interactions, etc editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 13, 2024
@JosephTLyons JosephTLyons changed the title Jump to implmentation from interface/trait Jump to implementation from interface/trait Feb 13, 2024
@JosephTLyons
Copy link
Collaborator

Hey @goldenratio, just to mention it, we do have a Find All References action, although this will include more than just the impl block of some trait, so it isn't the exact same thing.

@kousikmitra
Copy link

This is one things that makes me switch to vs code frequently. ➕ to this request.

@facs95
Copy link

facs95 commented Jan 22, 2025

+1 here! Are there any plans to implement this?

@SomeoneToIgnore
Copy link
Contributor

We actually have it as an editor action for quite some time:

we_have_it.mov

Underneath, it uses LSP to query for applicable implementations at the location, queried:

pub fn implementation<T: ToPointUtf16>(
&mut self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<LocationLink>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
GetImplementation { position },
cx,
)
}

So if the corresponding language server is able to return that (as for rust-analyzer in the video above), Zed will either navigate straight to the place (if it's a single one) or open a multi buffer with all applicable options (from where, jumping can be done with alt-enter, header or line number click).

What's missing is gutter icons, but not sure if Zed designer team wants to add those.
It's also not very clear how to add these icons generically: in Zed, each language has different tree-sitter queries that denote "struct", "interface", etc. entities — we do not have a good way to specify which of these entities are worth querying for implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] workspace Feedback for workspace management, layout, interactions, etc
Projects
None yet
Development

No branches or pull requests

5 participants