Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Basic code intel always pops up definition panel with class and constructors when jumping to class #4225

Closed
@felixfbecker

Description

@felixfbecker

Basic code intel is currently annoying to use because it almost always pops up the definition panel on jump-to-definition.

One of these cases is when jumping to the class from an instantiation in languages where the constructor has the same name as the class:

https://sourcegraph.com/github.com/PowerShell/PowerShell@61c7b7f1204b282028816d958e904585ab9b2cfd/-/blob/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData_Complex.cs#L511:24&tab=def

image

image

The definition panel always pops up with the class and the constructors. There is an argument to be made when there are multiple constructors, but not when there is only one.

Possible solutions:

When the reference looks like an instantiation (has a new token in front of it), it could filter the result by kind: CLASS.

Alternatively, when the API only returns one symbol of kind CLASS and one of kind METHOD where the method has a name of the class, constructor, __construct etc and the name of the class is a substring of the method's container name the method can be assumed to be the constructor that was invoked. It could always jump to that if there is only one.

Metadata

Metadata

Assignees

Labels

team/graphGraph Team (previously Code Intel/Language Tools/Language Platform)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions