Skip to content

Commit

Permalink
add alter function completion
Browse files Browse the repository at this point in the history
  • Loading branch information
rolang committed Feb 8, 2024
1 parent f0f2008 commit cb9261d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/core/shared/src/main/scala/data/Completion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object Completion {
case object AlterType extends Completion
case object CreateFunction extends Completion
case object DropFunction extends Completion
case object AlterFunction extends Completion
case class Copy(count: Int) extends Completion
case object Show extends Completion
case object Do extends Completion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ object CommandComplete {
case "ALTER TYPE" => apply(Completion.AlterType)
case "CREATE FUNCTION" => apply(Completion.CreateFunction)
case "DROP FUNCTION" => apply(Completion.DropFunction)
case "ALTER FUNCTION" => apply(Completion.AlterFunction)
case "SHOW" => apply(Completion.Show)
case "DO" => apply(Completion.Do)
case "CREATE PROCEDURE" => apply(Completion.CreateProcedure)
Expand Down
7 changes: 7 additions & 0 deletions modules/tests/shared/src/test/scala/CommandTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ class CommandTest extends SkunkTest {
END;'
""".command

val alterFunction: Command[Void] =
sql"""
ALTER FUNCTION my_trigger_func() RESET search_path
""".command

val dropFunction: Command[Void] =
sql"DROP FUNCTION my_trigger_func;".command

Expand Down Expand Up @@ -401,6 +406,8 @@ class CommandTest extends SkunkTest {
_ <- assert("completion", c == Completion.AlterTrigger)
c <- s.execute(dropTrigger)
_ <- assert("completion", c == Completion.DropTrigger)
c <- s.execute(alterFunction)
_ <- assert("completion", c == Completion.AlterFunction)
c <- s.execute(dropFunction)
_ <- assert("completion", c == Completion.DropFunction)
_ <- s.assertHealthy
Expand Down

0 comments on commit cb9261d

Please sign in to comment.