Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: dont rely on code blocks to change language in code_selector #2532

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions cmd/ftl-gen-lsp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,6 @@ func stripNonGoDocs(content string) string {
continue
}

// Similar, look at the code block
if strings.HasPrefix(line, "```") {
newLang := strings.TrimPrefix(line, "```")
if newLang != "" {
currentLang = newLang
}
}

// If we're in a Go block or unspecified, collect the line.
if currentLang == "go" || currentLang == "" {
collected = append(collected, line)
Expand Down
4 changes: 4 additions & 0 deletions docs/content/docs/reference/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ top = false

Some aspects of FTL rely on a runtime which must be imported with:

<!-- go -->

```go
import "github.com/TBD54566975/ftl/go-runtime/ftl"
```

<!-- kotlin -->

```kotlin
// Declare a verb you want to use:
import xyz.block.ftl.Verb
Expand Down
22 changes: 12 additions & 10 deletions docs/content/docs/reference/verbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ top = false
<!-- go -->
To declare a Verb, write a normal Go function with the following signature, annotated with the Go [comment directive](https://tip.golang.org/doc/comment#syntax) `//ftl:verb`:

<!-- kotlin -->
To declare a Verb, write a normal Kotlin function with the following signature, annotated with the Kotlin [annotation](https://kotlinlang.org/docs/annotations.html) `@Verb`:

```go
//ftl:verb
func F(context.Context, In) (Out, error) { }
```

```kotlin
@Verb
fun F(Context, In): Out { }
```

eg.

```go
Expand All @@ -46,6 +38,16 @@ func Echo(ctx context.Context, in EchoRequest) (EchoResponse, error) {
}
```

<!-- kotlin -->
To declare a Verb, write a normal Kotlin function with the following signature, annotated with the Kotlin [annotation](https://kotlinlang.org/docs/annotations.html) `@Verb`:

```kotlin
@Verb
fun F(Context, In): Out { }
```

eg.

```kotlin
data class EchoRequest
data class EchoResponse
Expand All @@ -56,10 +58,10 @@ fun echo(ctx: Context, request: EchoRequest): EchoResponse {
}
```

By default verbs are only [visible](../visibility) to other verbs in the same module.

{% end %}

By default verbs are only [visible](../visibility) to other verbs in the same module.

## Calling Verbs

{% code_selector() %}
Expand Down
6 changes: 0 additions & 6 deletions docs/static/js/code-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ function injectTabs(codeSelector) {
currentLang = lang;
toAdd = { lang, element };
}
} else if (element.tagName === "PRE") {
// pre with data-lang attribute
const lang = element.getAttribute("data-lang");
// code blocks reset the currentLang.
currentLang = null;
toAdd = { lang, element };
} else if (currentLang) {
// if we are in a currentLang, then add the element to it.
toAdd = { lang: currentLang, element };
Expand Down
4 changes: 2 additions & 2 deletions internal/lsp/hoveritems.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading