Skip to content

List all workspace symbols when an empty query comes in #603

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

Closed
wants to merge 1 commit into from
Closed

List all workspace symbols when an empty query comes in #603

wants to merge 1 commit into from

Conversation

groig
Copy link

@groig groig commented Sep 2, 2021

According to the specification the workspace symbols provider should
accept an empty query string and return all the symbols in that case

https://microsoft.github.io/language-server-protocol/specification#workspace_symbol

/**
 * The parameters of a Workspace Symbol Request.
 */
interface WorkspaceSymbolParams extends WorkDoneProgressParams,
	PartialResultParams {
	/**
	 * A query string to filter symbols by. Clients may send an empty
	 * string here to request all symbols.
	 */
	query: string;
}

The test is quite primitive as I am an Elixir beginner. If this feature is of interest I would appreciate some help improving them.

@groig groig changed the title List all symbols when an empty query comes in List all workspace symbols when an empty query comes in Sep 2, 2021
According to the specification the workspace symbols provider should
accept an empty query string and return all the symbols in that case

https://microsoft.github.io/language-server-protocol/specification#workspace_symbol

```
/**
 * The parameters of a Workspace Symbol Request.
 */
interface WorkspaceSymbolParams extends WorkDoneProgressParams,
	PartialResultParams {
	/**
	 * A query string to filter symbols by. Clients may send an empty
	 * string here to request all symbols.
	 */
	query: string;
}
```
@lukaszsamson
Copy link
Collaborator

@groig Have you tested it on any decent size project? IIRC this was super slow and that's why I explicitly disabled returning everything.

@groig
Copy link
Author

groig commented Sep 2, 2021

@groig Have you tested it on any decent size project? IIRC this was super slow and that's why I explicitly disabled returning everything.

I tested it on elixir-ls itself and it's not bad.

@axelson
Copy link
Member

axelson commented Sep 6, 2021

I tested it on elixir-ls itself and it's not bad.

Elixir-ls is a rather small project compared to the applications that many developers are running on which can have thousands of modules.

@groig
Copy link
Author

groig commented Oct 1, 2021

Sorry for the delay answering.

I understand that requesting every workspace symbol may be slow in some projects, but the feature does not impact the existing workspace symbol search. I see that lots of language servers decided to not implement this part of the spec (gopls, python-lsp-server, pyright, rust-analyzer). I personally find it useful as a replacement for ctags so my editor's client now requests the symbol list periodically to the server and keeps a local cache. Maybe the performance could be improved following a similar approach to #261 and returning only the symbols of the modules in the current application.

Feel free to close the pull request if the feature is not accepted.

@lukaszsamson
Copy link
Collaborator

@groig I revisited this idea in #1050 - with limiting indexing to only modules from the project it is feasible to query with empty needle

@groig groig deleted the list-all-symbols branch January 9, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants