diff --git a/functions/tree-sitter/cmd/ts/main.go b/functions/tree-sitter/cmd/ts/main.go index 5d0c3c9..62c948c 100644 --- a/functions/tree-sitter/cmd/ts/main.go +++ b/functions/tree-sitter/cmd/ts/main.go @@ -13,7 +13,12 @@ import ( "github.com/smacker/go-tree-sitter/bash" "github.com/smacker/go-tree-sitter/html" "github.com/smacker/go-tree-sitter/dockerfile" + "github.com/smacker/go-tree-sitter/golang" + "github.com/smacker/go-tree-sitter/java" + "github.com/smacker/go-tree-sitter/javascript" markdown "github.com/smacker/go-tree-sitter/markdown/tree-sitter-markdown" + typescript "github.com/smacker/go-tree-sitter/typescript/typescript" + tsx "github.com/smacker/go-tree-sitter/typescript/tsx" ) func main() { @@ -52,6 +57,16 @@ func main() { lang = dockerfile.GetLanguage() case "markdown": lang = markdown.GetLanguage() + case "golang": + lang = golang.GetLanguage() + case "java": + lang = java.GetLanguage() + case "javascript": + lang = javascript.GetLanguage() + case "typescript": + lang = typescript.GetLanguage() + case "tsx": + lang = tsx.GetLanguage() default: fmt.Printf("Unsupported language: %s\n", language) return diff --git a/functions/tree-sitter/flake.nix b/functions/tree-sitter/flake.nix index 3ad6763..3be996e 100644 --- a/functions/tree-sitter/flake.nix +++ b/functions/tree-sitter/flake.nix @@ -43,7 +43,7 @@ # If you're not using vendored dependencies, compute the hash of your go.mod and go.sum # You can get this hash by first setting it to lib.fakeSha256, # then running the build and replacing it with the correct hash - vendorHash = "sha256-ZAlkGegeFLqvHlGD1oA08NS216r6WsWFkajzxI+jLX4="; + vendorHash = "sha256-/X9cuzpVzVOqcON3c2GtUwCXi6gfFzjjQ8r+D0Yhgu8="; # Specify the package to build if it's not in the root of your project subPackages = [ "cmd/ts" ]; diff --git a/functions/tree-sitter/go.mod b/functions/tree-sitter/go.mod index 77166e7..fba505d 100644 --- a/functions/tree-sitter/go.mod +++ b/functions/tree-sitter/go.mod @@ -1,5 +1,5 @@ module tree-sitter-query -go 1.20 +go 1.22 require github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 diff --git a/functions/tree-sitter/runbook.md b/functions/tree-sitter/runbook.md index 6552af8..076429f 100644 --- a/functions/tree-sitter/runbook.md +++ b/functions/tree-sitter/runbook.md @@ -18,6 +18,7 @@ docker buildx build \ --tag vonwig/tree-sitter:latest \ --file Dockerfile \ --push . +docker pull vonwig/tree-sitter:latest ``` ```sh