Skip to content

Allow multiple ranges/locations in DocumentSymbol #1285

@dibarbet

Description

@dibarbet

The spec defines the range of a document symbol request as

/**
* The range enclosing this symbol not including leading/trailing whitespace
* but everything else like comments. This information is typically used to
* determine if the clients cursor is inside the symbol to reveal in the
* symbol in the UI.
*/
range: Range;

For C# this can be a problem when one symbol has multiple distinct ranges. For example, if you had this C# code

partial class A
{

}

class B
{

}

partial class A
{

}

In this case there is one document symbol for A which we would show in the UI. Placing the caret in either of the partial declarations should reveal A. We can't combine the ranges from each part since there's an interceding type between them.

Of course, these could be in different files as well, so having these be Locations as well would be required. Related to #1255 (kept this issue separate as we're requesting multiple locations, feel free to dupe though if it should be tracked under one issue)

If modifying the existing field is acceptable

range: Range | Location[]

or could add a new field (note that we'd likely still want to support having the original range as a location)

additionalLocations: Location[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions