Skip to content

Pin tree-sitter language grammar versions

Tan Le requested to merge fix-build-issue into main

What does this merge request do and why?

Pin tree-sitter language grammar versions

We are currently building tree-sitter grammars using the latest Git commits. While this allows us to pick up new improvements fast, it also can cause unexpected breaking changes. This commit also add some improvements to the git clone command to speed up the cloning process.

How to set up and validate locally

  1. Check out to this merge request's branch.
  2. Ensure a local Docker image built successfully.
    docker buildx build --platform linux/amd64 \
      -t code-suggestions-api:dev .
  3. Run a local service on Docker.
    docker run --platform linux/amd64 --rm \
      -p 5052:5052 \
      -e AUTH_BYPASS_EXTERNAL=true \
      -v $PWD:/app -it code-suggestions-api:dev
  4. Send a few requests for Kotlin and TypeScript and confirm 200 responses
curl --request POST \
  --url http://codesuggestions.gdk.test:5999/v2/completions \
  --header 'Content-Type: application/json' \
  --header 'X-Gitlab-Authentication-Type: oidc' \
  --header 'authorization: Bearer abcd' \
  --data '{
	"prompt_version": 1,
	"project_path": "awesome_project",
	"project_id": 23,
	"current_file": {
		"file_name": "calculator.kt",
		"content_above_cursor": "fun File.appendText(\n    text: String,\n    charset: Charset =",
		"content_below_cursor": ""
	}
}'
curl --request POST \
  --url http://codesuggestions.gdk.test:5999/v2/completions \
  --header 'Content-Type: application/json' \
  --header 'X-Gitlab-Authentication-Type: oidc' \
  --header 'authorization: Bearer abcd' \
  --data '{
	"prompt_version": 1,
	"project_path": "awesome_project",
	"project_id": 23,
	"current_file": {
		"file_name": "hello.tsx",
		"content_above_cursor": "const name = '\''Josh Perez'\'';\nconst element = <h1>Hello, {name}",
		"content_below_cursor": ""
	}
}'

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Tan Le

Merge request reports