-
-
Notifications
You must be signed in to change notification settings - Fork 75
feat: configure Workspace Symbols to return all symbols on empty query #293
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cf483c1
fix(expert): use persistent_term as single source of truth for config…
doorgan e30daf6
feat(expert): add workspaceSymbols.minQueryLength configuration option
doorgan 1f1ab2d
docs: add configuration documentation
doorgan 9a679fc
refactor(expert): add Handler behaviour and simplify handler interface
doorgan 7acd360
fix: remove unused dialyzer configuration
doorgan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| defmodule Expert.Configuration.WorkspaceSymbols do | ||
| @moduledoc false | ||
|
|
||
| defstruct min_query_length: 2 | ||
|
|
||
| @type t :: %__MODULE__{ | ||
| min_query_length: non_neg_integer() | ||
| } | ||
|
|
||
| def new(settings \\ %{}) | ||
|
|
||
| def new(settings) when is_map(settings) do | ||
| workspace_symbols_settings = Map.get(settings, "workspaceSymbols", %{}) | ||
|
|
||
| %__MODULE__{ | ||
| min_query_length: parse_min_query_length(workspace_symbols_settings) | ||
| } | ||
| end | ||
|
|
||
| defp parse_min_query_length(%{"minQueryLength" => value}) | ||
| when is_integer(value) and value >= 0, | ||
| do: value | ||
|
|
||
| defp parse_min_query_length(_), do: 2 | ||
| end | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| defmodule Expert.Provider.Handler do | ||
| @moduledoc """ | ||
| Behaviour for LSP request and notification handlers. | ||
| """ | ||
|
|
||
| @doc """ | ||
| Handles an LSP request or notification. | ||
|
|
||
| Returns `{:ok, response}` on success, or `{:error, reason}` on failure. | ||
| For notifications that don't require a response, return `{:ok, nil}`. | ||
| """ | ||
| @callback handle(request :: struct()) :: {:ok, term()} | {:error, term()} | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity - what's the reason behind having this default to
2and allowing user to configure this altogether? performance? because to me it looks like0as hardcoded would be a reasonable thing to have and I don't recall other LSes having such configThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the previous behavior, I had to type 2 characters to get completions before this change. Hardcoding
0makes us return every result and let the client filter them, which is the NextLS behavior. Having >0 causes the server to filter results first, which is the Lexical behavior.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I get this. I was wondering why
2was in the first place here 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure! Maybe because a single letter wasn't considered specific enough for filtering to be meaningful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be editor-specific. VSCode and IntelliJ I know have even some ML models for sorting such things. otoh probably helix/neovim (not using them) just throw stuff as they get from the LSP. So I guess, perhaps the original author picked what worked in his editor? 🤔