zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.99k stars 2.7k forks source link

Completions to be ranked by proximity #17277

Open gdandersson opened 1 week ago

gdandersson commented 1 week ago

Check for existing issues

Describe the feature

If I have a PHP line like the following: $acl_company->can_see = $request->company_can_see;

go to the line below and start typing $acl_ and press key to show completions, shouldn't "acl_company" be the first completion? Instead it seems to find $acl_user five lines away and put this as the most important completion

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

No response

notpeter commented 1 week ago

Which PHP language server are you using? phpactor or intelephense?

gdandersson commented 1 week ago

The default, phpactor

osiewicz commented 1 week ago

We as an editor don't currently do this; as in, we don't parse your code to figure out what the best completion candidate is. Language server protocol has a notion of sort priority (via sort_text), so in theory a language server could sort completions in the list based on "proximity". I however don't think that it should be Zed's responsibility, as it's better suited to be implemented on the language server side.