Skip to content

Commit

Permalink
fix #706: mock completers
Browse files Browse the repository at this point in the history
  • Loading branch information
tconbeer committed Dec 19, 2024
1 parent 2ddd55f commit 8cc442f
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 72 deletions.
20 changes: 9 additions & 11 deletions src/harlequin_sqlite/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@

from harlequin.autocomplete.completion import HarlequinCompletion

def _get_functions(conn: sqlite3.Connection) -> list[tuple[str, str]]:
return conn.execute(
"""
select distinct
name as label,
case when type = 'w' then 'agg' else 'fn' end as type_label
from pragma_function_list
order by name asc
"""
).fetchall()

def get_completion_data(conn: sqlite3.Connection) -> list[HarlequinCompletion]:
KEYWORDS = [
Expand Down Expand Up @@ -227,7 +217,15 @@ def get_completion_data(conn: sqlite3.Connection) -> list[HarlequinCompletion]:
"wal_checkpoint",
]

function_data = _get_functions(conn)
function_data = conn.execute(
"""
select distinct
name as label,
case when type = 'w' then 'agg' else 'fn' end as type_label
from pragma_function_list
order by name asc
"""
).fetchall()

keyword_completions = [
HarlequinCompletion(
Expand Down
Loading

0 comments on commit 8cc442f

Please sign in to comment.