Skip to content

Commit 7c6941b

Browse files
authored
feat: add params to symbols table (#397)
1 parent 4aa157f commit 7c6941b

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/next_ls.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ defmodule NextLS do
220220
[] ->
221221
nil
222222

223-
[[_pk, _mod, file, _type, _name, line, column | _] | _] ->
223+
[[_pk, _mod, file, _type, _name, _params, line, column | _] | _] ->
224224
%Location{
225225
uri: "file://#{file}",
226226
range: %Range{
@@ -450,7 +450,7 @@ defmodule NextLS do
450450
[]
451451
)
452452

453-
for [_pk, module, file, type, name, line, column | _] <- rows do
453+
for [_pk, module, file, type, name, _params, line, column | _] <- rows do
454454
%{
455455
module: module,
456456
file: file,

lib/next_ls/db.ex

+13-4
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,23 @@ defmodule NextLS.DB do
127127
)
128128
end
129129

130-
for {name, {:v1, type, _meta, clauses}} <- defs, {meta, _, _, _} <- clauses do
130+
for {name, {:v1, type, _meta, clauses}} <- defs, {meta, params, _, _} <- clauses do
131131
__query__(
132132
{conn, s.logger},
133133
~Q"""
134-
INSERT INTO symbols (module, file, type, name, line, 'column', source)
135-
VALUES (?, ?, ?, ?, ?, ?, ?);
134+
INSERT INTO symbols (module, file, type, name, params, line, 'column', source)
135+
VALUES (?, ?, ?, ?, ?, ?, ?, ?);
136136
""",
137-
[mod, file, type, name, meta[:line], meta[:column] || 1, source]
137+
[
138+
mod,
139+
file,
140+
type,
141+
name,
142+
:erlang.term_to_binary(params),
143+
meta[:line],
144+
meta[:column] || 1,
145+
source
146+
]
138147
)
139148
end
140149

lib/next_ls/db/schema.ex

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule NextLS.DB.Schema do
2323

2424
alias NextLS.DB
2525

26-
@version 5
26+
@version 6
2727

2828
def init(conn) do
2929
# FIXME: this is odd tech debt. not a big deal but is confusing
@@ -80,6 +80,7 @@ defmodule NextLS.DB.Schema do
8080
file text NOT NULL,
8181
type text NOT NULL,
8282
name text NOT NULL,
83+
params blob,
8384
line integer NOT NULL,
8485
column integer NOT NULL,
8586
source text NOT NULL DEFAULT 'user',

0 commit comments

Comments
 (0)