Skip to content

Commit

Permalink
docs(lsp): remove trivial completions, ftl:, add fsm
Browse files Browse the repository at this point in the history
  • Loading branch information
gak committed Jun 16, 2024
1 parent c36af12 commit 3465617
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 47 deletions.
24 changes: 8 additions & 16 deletions lsp/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ var retryCompletionDocs string
//go:embed markdown/completion/configDeclare.md
var declareConfigCompletionDocs string

//go:embed markdown/completion/configGet.md
var getConfigCompletionDocs string

//go:embed markdown/completion/secretDeclare.md
var declareSecretCompletionDocs string

//go:embed markdown/completion/secretGet.md
var getSecretCompletionDocs string

//go:embed markdown/completion/pubSubTopic.md
var declarePubSubTopicCompletionDocs string

Expand All @@ -52,8 +46,8 @@ var declarePubSubSubscriptionCompletionDocs string
//go:embed markdown/completion/pubSubSink.md
var definePubSubSinkCompletionDocs string

//go:embed markdown/completion/pubSubPublish.md
var publishPubSubEventCompletionDocs string
//go:embed markdown/completion/fsmDeclare.md
var fsmCompletionDocs string

// Markdown is split by "---". First half is completion docs, second half is insert text.
var completionItems = []protocol.CompletionItem{
Expand All @@ -64,14 +58,12 @@ var completionItems = []protocol.CompletionItem{
completionItem("ftl:ingress", "FTL Ingress", ingressCompletionDocs),
completionItem("ftl:cron", "FTL Cron", cronCompletionDocs),
completionItem("ftl:retry", "FTL Retry", retryCompletionDocs),
completionItem("config:declare", "Declare config", declareConfigCompletionDocs),
completionItem("config:get", "Get config", getConfigCompletionDocs),
completionItem("secret:declare", "Declare secret", declareSecretCompletionDocs),
completionItem("secret:get", "Get secret", getSecretCompletionDocs),
completionItem("pubsub:topic", "Declare PubSub topic", declarePubSubTopicCompletionDocs),
completionItem("pubsub:subscription", "Declare a PubSub subscription", declarePubSubSubscriptionCompletionDocs),
completionItem("pubsub:sink", "Define a PubSub sink", definePubSubSinkCompletionDocs),
completionItem("pubsub:publish", "Publish a PubSub event", publishPubSubEventCompletionDocs),
completionItem("ftl:config:declare", "Declare config", declareConfigCompletionDocs),
completionItem("ftl:secret:declare", "Declare secret", declareSecretCompletionDocs),
completionItem("ftl:pubsub:topic", "Declare PubSub topic", declarePubSubTopicCompletionDocs),
completionItem("ftl:pubsub:subscription", "Declare a PubSub subscription", declarePubSubSubscriptionCompletionDocs),
completionItem("ftl:pubsub:sink", "Define a PubSub sink", definePubSubSinkCompletionDocs),
completionItem("ftl:fsm", "Model a FSM", fsmCompletionDocs),
}

func completionItem(label, detail, markdown string) protocol.CompletionItem {
Expand Down
4 changes: 2 additions & 2 deletions lsp/markdown/completion/configDeclare.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Snippet for declaring a config variable.

```go
var defaultUser = ftl.Config[string]("default")
var defaultUser = ftl.Config[string]("defaultUser")
```

See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/
---
var ${1:configVar} = ftl.Config[${2:Type}](${3:default})
var ${1:configVar} = ftl.Config[${2:Type}](${1:configVar})
9 changes: 0 additions & 9 deletions lsp/markdown/completion/configGet.md

This file was deleted.

20 changes: 20 additions & 0 deletions lsp/markdown/completion/fsmDeclare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Snippet for declaring a FSM model.

```go
var payment = ftl.FSM(
"payment",
ftl.Start(Invoiced),
ftl.Start(Paid),
ftl.Transition(Invoiced, Paid),
ftl.Transition(Invoiced, Defaulted),
)
```

See https://tbd54566975.github.io/ftl/docs/reference/fsm/
---
var ${1:FSM} = ftl.FSM(
"${1:FSM}",
ftl.Start(${2:verbState}),
ftl.Transition(${2:fromVerbState}, ${3:toVerbState}),
)
```
10 changes: 0 additions & 10 deletions lsp/markdown/completion/pubSubPublish.md

This file was deleted.

2 changes: 1 addition & 1 deletion lsp/markdown/completion/secretDeclare.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ var apiKey = ftl.Secret[string]("apiKey")

See https://tbd54566975.github.io/ftl/docs/reference/secretsconfig/
---
var ${1:secretVar} = ftl.Secret[${2:Type}](${3:default})
var ${1:secretVar} = ftl.Secret[${2:Type}](${3:secretVar})
9 changes: 0 additions & 9 deletions lsp/markdown/completion/secretGet.md

This file was deleted.

0 comments on commit 3465617

Please sign in to comment.