-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Workspace symbols Wired up workspace symbols. Things work, but this needs some _love_. The search is kind of slow, and results are not particularly relevant. I also don't use this feature much, so I don't know if we're supposed to find _everything_ or, say, definitions. I'm putting this up here as a draft PR while I open another branch that will work toward improving relevance and performance. * Improved performance / utility of fuzzy matcher and scorer Made somewhat significant changes to the fuzzy matcher to improve performance and relevance of the results. I found that the matcher was returning a ton of results when it was returning references to things, so I pared it down to only consider definitions, which seems to improve the relevance of results a lot. I also only had it return definitions in one of the current project's applications, as searching your dependencies for a definition didn't seem to be a common use case. The fuzzy matcher also now considers the type of the entry being indexed when it builds the subject. This gives us much nicer and more relevant search results, and gives us the ability to tune them more specifically in the future.
- Loading branch information
Showing
29 changed files
with
664 additions
and
169 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
apps/protocol/lib/generated/lexical/protocol/types/location/link.ex
This file contains 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,11 @@ | ||
# This file's contents are auto-generated. Do not edit. | ||
defmodule Lexical.Protocol.Types.Location.Link do | ||
alias Lexical.Proto | ||
alias Lexical.Protocol.Types | ||
use Proto | ||
|
||
deftype origin_selection_range: optional(Types.Range), | ||
target_range: Types.Range, | ||
target_selection_range: Types.Range, | ||
target_uri: string() | ||
end |
19 changes: 19 additions & 0 deletions
19
apps/protocol/lib/generated/lexical/protocol/types/workspace/symbol.ex
This file contains 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,19 @@ | ||
# This file's contents are auto-generated. Do not edit. | ||
defmodule Lexical.Protocol.Types.Workspace.Symbol do | ||
alias Lexical.Proto | ||
alias Lexical.Protocol.Types | ||
|
||
defmodule Location do | ||
use Proto | ||
deftype uri: string() | ||
end | ||
|
||
use Proto | ||
|
||
deftype container_name: optional(string()), | ||
data: optional(any()), | ||
kind: Types.Symbol.Kind, | ||
location: one_of([Types.Location, Lexical.Protocol.Types.Workspace.Symbol.Location]), | ||
name: string(), | ||
tags: optional(list_of(Types.Symbol.Tag)) | ||
end |
10 changes: 10 additions & 0 deletions
10
apps/protocol/lib/generated/lexical/protocol/types/workspace/symbol/params.ex
This file contains 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,10 @@ | ||
# This file's contents are auto-generated. Do not edit. | ||
defmodule Lexical.Protocol.Types.Workspace.Symbol.Params do | ||
alias Lexical.Proto | ||
alias Lexical.Protocol.Types | ||
use Proto | ||
|
||
deftype partial_result_token: optional(Types.Progress.Token), | ||
query: string(), | ||
work_done_token: optional(Types.Progress.Token) | ||
end |
This file contains 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 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 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 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
57 changes: 57 additions & 0 deletions
57
apps/remote_control/lib/lexical/remote_control/code_intelligence/symbols/workspace.ex
This file contains 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,57 @@ | ||
defmodule Lexical.RemoteControl.CodeIntelligence.Symbols.Workspace do | ||
defmodule Link do | ||
defstruct [:uri, :range, :detail_range] | ||
|
||
@type t :: %__MODULE__{ | ||
uri: Lexical.uri(), | ||
range: Lexical.Document.Range.t(), | ||
detail_range: Lexical.Document.Range.t() | ||
} | ||
|
||
def new(uri, range, detail_range \\ nil) do | ||
%__MODULE__{uri: uri, range: range, detail_range: detail_range} | ||
end | ||
end | ||
|
||
alias Lexical.Document | ||
alias Lexical.Formats | ||
alias Lexical.RemoteControl.Search.Indexer.Entry | ||
|
||
defstruct [:name, :type, :link, container_name: nil] | ||
|
||
@type t :: %__MODULE__{ | ||
container_name: String.t() | nil, | ||
link: Link.t(), | ||
name: String.t(), | ||
type: atom() | ||
} | ||
|
||
def from_entry(%Entry{} = entry) do | ||
link = | ||
entry.path | ||
|> Document.Path.to_uri() | ||
|> Link.new(entry.block_range, entry.range) | ||
|
||
name = symbol_name(entry.type, entry) | ||
|
||
%__MODULE__{ | ||
name: name, | ||
type: entry.type, | ||
link: link | ||
} | ||
end | ||
|
||
@module_types [ | ||
:struct, | ||
:module, | ||
:protocol, | ||
:protocol_implementation | ||
] | ||
|
||
defp symbol_name(type, entry) when type in @module_types do | ||
Formats.module(entry.subject) | ||
end | ||
|
||
defp symbol_name(_, entry), | ||
do: entry.subject | ||
end |
Oops, something went wrong.