File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
lib/sequin_web/live/functions Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 82
82
export let usedByConsumers: Consumer [] = [];
83
83
export let initialCodeMap: Record <string , string >;
84
84
export let functionTransformsEnabled: boolean ;
85
- export let functionCompletions : Array <{
85
+ export let completions : Array <{
86
86
label: string ;
87
87
type: string ;
88
88
info: string ;
218
218
219
219
return {
220
220
from: word .from ,
221
- options: [... variableCompletions , ... functionCompletions ],
221
+ options: [... variableCompletions , ... completions ],
222
222
};
223
223
};
224
224
Original file line number Diff line number Diff line change 1
1
defmodule SequinWeb.FunctionLive.AutoComplete do
2
2
@ moduledoc false
3
+ @ reserved_words ~w( do if else end case cond for with fn)
3
4
@ function_completion_modules [
4
5
Date ,
5
6
DateTime ,
@@ -13,6 +14,14 @@ defmodule SequinWeb.FunctionLive.AutoComplete do
13
14
Base
14
15
]
15
16
17
+ def all_completions do
18
+ reserved_completions ( ) ++ function_completions ( )
19
+ end
20
+
21
+ def reserved_completions do
22
+ Enum . map ( @ reserved_words , & % { label: & 1 , type: "keyword" } )
23
+ end
24
+
16
25
def function_completions do
17
26
Enum . flat_map ( @ function_completion_modules , & function_completions / 1 )
18
27
end
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ defmodule SequinWeb.FunctionsLive.Edit do
216
216
217
217
# We generate the function completions at compile time because
218
218
# docs are not available at runtime in our release.
219
- @ function_completions AutoComplete . function_completions ( )
219
+ @ all_completions AutoComplete . all_completions ( )
220
220
221
221
@ impl Phoenix.LiveView
222
222
def mount ( params , _session , socket ) do
@@ -264,7 +264,7 @@ defmodule SequinWeb.FunctionsLive.Edit do
264
264
selected_table_oid: nil ,
265
265
synthetic_test_message: Consumers . synthetic_message ( ) ,
266
266
initial_code: @ initial_code_map ,
267
- function_completions : @ function_completions ,
267
+ all_completions : @ all_completions ,
268
268
function_transforms_enabled: Sequin . feature_enabled? ( current_account_id ( socket ) , :function_transforms )
269
269
)
270
270
|> assign_encoded_messages ( )
@@ -292,7 +292,7 @@ defmodule SequinWeb.FunctionsLive.Edit do
292
292
initialCodeMap: @ initial_code ,
293
293
initialCode: "glugma" ,
294
294
functionTransformsEnabled: @ function_transforms_enabled ,
295
- functionCompletions : @ function_completions
295
+ completions : @ all_completions
296
296
}
297
297
}
298
298
socket = { @ socket }
You can’t perform that action at this time.
0 commit comments