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

Expose synchronous SymbolFinder.FindSourceDefinition #76489

Open
CyrusNajmabadi opened this issue Dec 18, 2024 · 0 comments
Open

Expose synchronous SymbolFinder.FindSourceDefinition #76489

CyrusNajmabadi opened this issue Dec 18, 2024 · 0 comments
Assignees
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@CyrusNajmabadi
Copy link
Member

The existing api is actually implemented this way:

    /// <summary>
    /// Finds the definition symbol declared in source code for a corresponding reference symbol. 
    /// Returns null if no such symbol can be found in the specified solution.
    /// </summary>
    public static Task<ISymbol?> FindSourceDefinitionAsync(ISymbol? symbol, Solution solution, CancellationToken cancellationToken = default)
        => Task.FromResult(FindSourceDefinition(symbol, solution, cancellationToken));

    /// <inheritdoc cref="FindSourceDefinitionAsync"/>
    internal static ISymbol? FindSourceDefinition(
        ISymbol? symbol, Solution solution, CancellationToken cancellationToken)

Where the public async entrypoint actually just defers to the synchronous impl. This is more painful to use for code that exists in layers that are public only, but which are in synchronous codepaths (for example, in syntax rewriters).

We shoudl just expose the synchronous version and optionally obsolete the async version, recommending people use it instead.

@CyrusNajmabadi CyrusNajmabadi added Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request labels Dec 18, 2024
@CyrusNajmabadi CyrusNajmabadi self-assigned this Dec 18, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant