Skip to content

Commit 00fbfbf

Browse files
committed
fix: only fetch most recent reference for that position
1 parent bff4eec commit 00fbfbf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: lib/next_ls/db.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ defmodule NextLS.DB do
174174
def __query__({conn, logger}, query, args) do
175175
args = Enum.map(args, &cast/1)
176176

177-
with {:error, _e} <- :esqlite3.q(conn, query, cast(args)) do
177+
with {:error, _e} <- :esqlite3.q(conn, query, args) do
178178
error = :esqlite3.error_info(conn).errmsg
179179
NextLS.Logger.error(logger, error)
180180
{:error, error}

Diff for: lib/next_ls/definition.ex

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ defmodule NextLS.Definition do
1818
AND refs.start_line <= ?
1919
AND ? <= refs.end_line
2020
AND refs.start_column <= ?
21-
AND ? <= refs.end_column;
21+
AND ? <= refs.end_column
22+
ORDER BY refs.id desc
23+
LIMIT 1;
24+
2225
""",
2326
[file, line, line, col, col]
2427
)

0 commit comments

Comments
 (0)