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

Improve ordering of "Go to symbol in workspace" results #71951

Closed
olafurpg opened this issue Apr 8, 2019 · 3 comments
Closed

Improve ordering of "Go to symbol in workspace" results #71951

olafurpg opened this issue Apr 8, 2019 · 3 comments
Labels
feature-request Request for new features or functionality quick-pick Quick-pick widget issues workspace-symbols

Comments

@olafurpg
Copy link

olafurpg commented Apr 8, 2019

Currently, workspace/symbol results are sometimes sorted in alphabetical order making it difficult to navigate to certain symbols

Screenshot 2019-04-08 at 20 03 16

I expected "CompletionSuite", which is at the bottom in the screenshot, to appear at the top because

  • it's the shortest result
  • it has a shared prefix "Compl" with the query "ComplSuite"

In this particular case, the language server (Metals, https://marketplace.visualstudio.com/itemdetails?itemName=scalameta.metals) returns "CompletionSuite" at the top of the results.

It would be nice if Visual Studio Code could either

  • improve the default ordering of items, or
  • introduce some option like "editor.workspaceSymbolOrdering": "default" | "language-server" to preserve the ordering from the language server
@bpasero bpasero added editor-symbols definitions, declarations, references feature-request Request for new features or functionality quick-pick Quick-pick widget issues workspace-symbols and removed editor-symbols definitions, declarations, references labels Apr 9, 2019
@bpasero bpasero removed their assignment Apr 9, 2019
@olafurpg
Copy link
Author

Another example where the default ordering could be improved

Screenshot 2019-04-25 at 08 43 34

I expected WorkspaceSymbolProvider to appear above TestingWorkspaceSymbolProvider. Also, I expected the uppercase S and P to be highlighted instead of lowercase sp.

@jrieken
Copy link
Member

jrieken commented Oct 23, 2019

This actually already happened

Screenshot 2019-10-23 at 10 46 25

@jrieken jrieken closed this as completed Oct 23, 2019
@olafurpg
Copy link
Author

olafurpg commented Dec 5, 2019

A recent release of VS Code seems to have regressed in the ordering of workspace/symbol results

Screenshot 2019-12-05 at 11 00 15

I expected the Add ; to search library dependencies to appear at the bottom of the list, which is how the ordering used to be in a previous release. The language server returned the following results

[Trace - 11:00:11 AM] Sending response 'workspace/symbol - (14004)'. Processing request took 2ms
Result: [
  {
    "name": "MetalsLanguageServer",
    "kind": 5,
    "location": {
      "uri": "file:///Users/lgeirsson/dev/metals/metals/src/main/scala/scala/meta/internal/metals/MetalsLanguageServer.scala",
      "range": {
        "start": {
          "line": 53,
          "character": 6
        },
        "end": {
          "line": 53,
          "character": 26
        }
      }
    },
    "containerName": "scala.meta.internal.metals."
  },
  {
    "name": "Add \u0027;\u0027 to search library dependencies",
    "kind": 24,
    "location": {
      "uri": "file:///Users/lgeirsson/dev/metals/.metals/workspace-symbol.md",
      "range": {
        "start": {
          "line": 0,
          "character": 0
        },
        "end": {
          "line": 0,
          "character": 0
        }
      }
    }
  }
]

Could it be that the uri is used for sorting in this situation? I would expect that it weighs more that the "LangSer" matches more closely "MetalsLanguageServer".

PS. I admit the Add ; to search library dependencies result is a hack 😅 It's a workaround to try and support a similar feature in IntelliJ.

2019-12-05 11 06 27

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality quick-pick Quick-pick widget issues workspace-symbols
Projects
None yet
Development

No branches or pull requests

3 participants