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

Sort go to definition results to show declarations inside the workspace first #1462

Closed
vinistock opened this issue Mar 6, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale

Comments

@vinistock
Copy link
Member

We're currently showing them in no particular order, but it's likely much more common for people to want to jump to declarations in their projects rather than the ones coming from gems or the standard library.

Since we know the file URIs, we should be able to sort results inside the workspace first.

@vinistock vinistock added enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale labels Mar 6, 2024
@snutij
Copy link
Contributor

snutij commented Mar 6, 2024

I'll be happy to work on it @vinistock 👍 I wonder if we should create an issue for workspace_symbol order also, to address this one: #1277 (see last comment).

@vinistock
Copy link
Member Author

I'm not sure if workspace symbol supports sorting though. But if it does, then indeed it would be great to sort that one too. I'll assign the issue to you!

@snutij
Copy link
Contributor

snutij commented Mar 17, 2024

Hello 👋. I have two questions regarding this issue:

  • we know the file URI that trigger the request, but have to compare entries resolved with workspace URI, which is an attribute of the store. I could pass it from executor to the request, then listener, but is it an acceptable approach? Actually, we are not using workspace URI in request, so I ask to be sure.
  • with VS Code, order seems not in our hand. Even when I reverse entries of definitions before returning Location to trigger an obvious change, it is still the same order. Someone can reproduce issue while definitions outside workspace returns first? I can reproduce with unitary test, but not with VS Code behavior, so i'm quite annoyed. 😔 IDK how other editors handle this.

Two issues & code from VS Code that seems related, but maybe I'm missing the point:

@vinistock
Copy link
Member Author

Hey, Justin. Yeah, it looks like we may not in fact be able to order things as intended. VS Code indeed merges responses coming from multiple sources, so if you have multiple language servers running you'll get the results from all of them.

It makes sense that in a scenario like that, you'd not be able to provide deterministic sorting since VS Code would not know how to order items coming from two different sources.

I think we may not be able to achieve what this issue originally intended, unfortunately. But thank you very much for looking into it!

Are you okay with closing this or is there anything else you'd like to research before?

@snutij
Copy link
Contributor

snutij commented Mar 26, 2024

👋 Yes I'm aligned with closing this issue, maybe there is room for improvement for other client, but as I said without more inputs on how they handle the server response it is hard to say. Thanks for taking time to answer!

@vinistock
Copy link
Member Author

vinistock commented Mar 26, 2024

Thank you for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

2 participants