Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacervello committed Mar 13, 2024
1 parent 4aa157f commit e45d034
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
22 changes: 18 additions & 4 deletions lib/next_ls/db.ex
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,28 @@ defmodule NextLS.DB do
)
end

for {name, {:v1, type, _meta, clauses}} <- defs, {meta, _, _, _} <- clauses do
for {name, {:v1, type, _meta, clauses}} <- defs, {meta, args, _, _} <- clauses do
__query__(
{conn, s.logger},
~Q"""
INSERT INTO symbols (module, file, type, name, line, 'column', source)
VALUES (?, ?, ?, ?, ?, ?, ?);
INSERT INTO symbols (module, file, type, name, params, line, 'column', source)
VALUES (?, ?, ?, ?, ?, ?, ?, ?);
""",
[mod, file, type, name, meta[:line], meta[:column] || 1, source]
[
mod,
file,
type,
name,
args
|> Enum.map_join(", ", fn
{id, _, _} -> Atom.to_string(id)
_otherwise -> ""
end)
|> dbg(),
meta[:line],
meta[:column] || 1,
source
]
)
end

Expand Down
3 changes: 2 additions & 1 deletion lib/next_ls/db/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule NextLS.DB.Schema do

alias NextLS.DB

@version 5
@version 6

def init(conn) do
# FIXME: this is odd tech debt. not a big deal but is confusing
Expand Down Expand Up @@ -80,6 +80,7 @@ defmodule NextLS.DB.Schema do
file text NOT NULL,
type text NOT NULL,
name text NOT NULL,
params text,
line integer NOT NULL,
column integer NOT NULL,
source text NOT NULL DEFAULT 'user',
Expand Down

0 comments on commit e45d034

Please sign in to comment.