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

Add file references provider #134405

Open
mjbvz opened this issue Oct 4, 2021 · 3 comments
Open

Add file references provider #134405

mjbvz opened this issue Oct 4, 2021 · 3 comments
Assignees
Labels
api feature-request Request for new features or functionality references-viewlet
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 4, 2021

I propose a new file references API that lets an extension tell VS Code about references to a given file. Possible use cases:

#21018 was somewhat related but for more generic relationships between files, not just references

JS/TS implements file references with a custom solution today. I feel it makes sense to lift this into a proper VS Code api so that we can provide a consistent experience for across languages

@mjbvz mjbvz added the api label Oct 4, 2021
@mjbvz
Copy link
Collaborator Author

mjbvz commented Oct 4, 2021

Proposed API would be quite simple:

export interface FileReferenceProvider {
	provideFileReferences(resource: vscode.Uri,  token: CancellationToken): ProviderResult<Location[]>;
}

export function registerFileReferenceProvider(selector: DocumentSelector, provider: FileReferenceProvider): Disposable;

I'm using a Location as the return type so the providers can return the specific line number of the reference

@mjbvz mjbvz added this to the Backlog milestone Oct 4, 2021
@jrieken jrieken added feature-request Request for new features or functionality references-viewlet labels Oct 5, 2021
@mjbvz
Copy link
Collaborator Author

mjbvz commented Apr 5, 2022

Added custom implementation to markdown with #146267

@dummdidumm
Copy link

A note regarding the current custom implementation (which I also noted in #151896): Right now "find file references" is implemented by temporarily switching the user config from "peek" to "view" to force-open the references view, which creates an empty vscode setting folder/file in the workplace if none exists already, which feels buggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feature-request Request for new features or functionality references-viewlet
Projects
None yet
Development

No branches or pull requests

3 participants