Skip to content

Commit

Permalink
Handle query string in Uri (erlang-ls#1283)
Browse files Browse the repository at this point in the history
The Uri returned by the `shallow_index` procedure is reconstructed
from the path and could miss the query string originally contained in
the input Uri.
  • Loading branch information
robertoaloi committed Apr 28, 2022
1 parent 7b4ada6 commit 4ac4ef1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/els_core/src/els_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ find_modules(Id) ->
%% If the module is not in the DB, try to index it.
-spec lookup_document(uri()) ->
{ok, els_dt_document:item()} | {error, any()}.
lookup_document(Uri) ->
case els_dt_document:lookup(Uri) of
lookup_document(Uri0) ->
case els_dt_document:lookup(Uri0) of
{ok, [Document]} ->
{ok, Document};
{ok, []} ->
Path = els_uri:path(Uri),
Path = els_uri:path(Uri0),
%% The returned Uri could be different from the original input
%% (e.g. if the original Uri would contain a query string)
{ok, Uri} = els_indexing:shallow_index(Path, app),
case els_dt_document:lookup(Uri) of
{ok, [Document]} ->
Expand Down

0 comments on commit 4ac4ef1

Please sign in to comment.