{"id":20591660,"url":"https://github.com/gdquest/zed-gdscript","last_synced_at":"2025-07-26T04:02:20.987Z","repository":{"id":224601174,"uuid":"763677579","full_name":"GDQuest/zed-gdscript","owner":"GDQuest","description":"Zed support for the GDScript language","archived":false,"fork":false,"pushed_at":"2025-06-15T12:32:56.000Z","size":38,"stargazers_count":72,"open_issues_count":14,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-15T13:44:14.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Tree-sitter Query","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GDQuest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":["https://gdquest.mavenseed.com/"]}},"created_at":"2024-02-26T18:14:41.000Z","updated_at":"2025-06-15T12:33:00.000Z","dependencies_parsed_at":"2024-08-14T12:57:55.527Z","dependency_job_id":"6d379076-8c10-4908-8fd2-1a6900737475","html_url":"https://github.com/GDQuest/zed-gdscript","commit_stats":null,"previous_names":["grndctrl/zed-gdscript","gdquest/zed-gdscript"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GDQuest/zed-gdscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDQuest%2Fzed-gdscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDQuest%2Fzed-gdscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDQuest%2Fzed-gdscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDQuest%2Fzed-gdscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GDQuest","download_url":"https://codeload.github.com/GDQuest/zed-gdscript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDQuest%2Fzed-gdscript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267116057,"owners_count":24038623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T07:41:12.933Z","updated_at":"2025-07-26T04:02:20.962Z","avatar_url":"https://github.com/GDQuest.png","language":"Tree-sitter Query","funding_links":["https://gdquest.mavenseed.com/"],"categories":[],"sub_categories":[],"readme":"# Zed GDScript Extension\n\nThis extension adds support for [GDScript](https://docs.godotengine.org/en/stable/classes/index.html), the scripting language used in the Godot game engine, to the Zed editor.\n\n## Requirements\n\n- Zed Editor.\n- Godot Engine (version 3.x or 4.x).\n- The program `nc` or `ncat` is available in your system PATH.\n\n## How to install\n\nTo get language server support in Godot, you will first need to install the Netcat program. Netcat is a small program that allows Zed and Godot to communicate with each other.\n\n### Installing Netcat\n\nYou can install Netcat from your package manager:\n\n- On Ubuntu/Debian Linux: `sudo apt install netcat`.\n- On Fedora Linux: `sudo dnf install nmap-ncat`.\n- On macOS: `brew install netcat`.\n\n### Installing the Zed GDScript Extension\n\n1. Open Zed.\n2. Go to Extensions.\n3. Search for *GDScript*.\n4. Click Install.\n\n### Starting the Godot Language Server\n\nUnlike other programming languages, Godot's language server is part of the Godot editor. Godot uses the context of your project and scene files to provide auto-completion and project-specific error checks. So, to get the full experience of the Godot language server, you need to open your project in Godot.\n\nAfter opening Godot, in Zed, you can use the command *editor: restart language server* to connect to Godot's language server.\n\n### Opening GDScript files in Zed instead of Godot\n\nIf you want to open GDScript files in Zed instead of Godot, you need to change Godot editor settings. In the Godot editor, go to *Editor \u003e Editor Settings \u003e Text Editor \u003e External* and enable *Use External Editor*. Set the *Exec Path* to the path of your Zed executable and the *Exec Flags* to `{project} {file}:{line}:{col}`. This will open files and jump to the correct line in Zed when you click on an error or warning in Godot.\n\nIf you have installed Godot and Zed via Flatpak on Linux, use the following parameters:\n\n1. Set \"Exec Path\" to `flatpak-spawn`.\n2. Set \"Exec Flags\" to `--host flatpak run dev.zed.Zed {project} {file}:{line}:{col}`.\n\n## Configuration\n\nGodot's language server is part of the Godot editor, and you need to open your project in Godot to use it.\n\nBy default, the extension matches the default settings of the Godot editor to connect to its language server:\n\n- Remote Host: 127.0.0.1\n- Remote Port: 6005\n\nYou can change these settings in Godot by going to *Editor \u003e Editor Settings \u003e Network \u003e Language Server*. If you do that, you'll need to change the settings in Zed to match. You can change these settings by adding the following JSON configuration to your `settings.json` file:\n\n```json\n{\n  \"lsp\": {\n    \"gdscript\": {\n      \"binary\": {\n        \"arguments\": [\"127.0.0.1\", \"6005\"]\n      }\n    }\n  }\n}\n```\n\n## Contributing\n\n## Editing .scm files\n\nThe `.scm` files in this repository are configuration files that capture the syntax and structure of GDScript code. They are used by the Zed editor to provide features like syntax highlighting, code folding, and symbol outlines.\n\nThey're written in the Scheme language and use Tree-Sitter to capture different bits.\n\nThe names and elements used in those files are, in large part, specific to the language you are working on. To edit them, you need to parse a source code file using the Tree-Sitter parser for that language.\n\n### Parsing GDScript with Tree-Sitter\n\nThe Zed editor uses a technology called Tree-Sitter to parse languages and create the outlines and syntax highlighting you see when using the extension. This technology allows people in the community to define a grammar for parsing a language, and Tree-Sitter will generate a parser for that language optimized for code editors.\n\nThe parser configuration for GDScript is maintained by PrestonKnopp: [tree-sitter-gdscript](https://github.com/PrestonKnopp/tree-sitter-gdscript).\n\nIn the `languages/gdscript` folder, you will find a series of `.scm` files that use syntax parsed by Tree-Sitter to capture symbols or specific portions of the code and add the features you see in Zed. To understand how these files work, you need to parse a GDScript file with PrestonKnopp's Tree-Sitter grammar. To do that, you need to:\n\n1. Install Tree-Sitter on your system. You can find the installation instructions in the [Tree-Sitter CLI README](https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md).\n2. Clone the [tree-sitter-gdscript](https://github.com/PrestonKnopp/tree-sitter-gdscript) repository.\n3. Build the parser by running `tree-sitter generate` in the cloned repository.\n4. Register the parser in your Tree-Sitter configuration. In a file named `config.json` in `~/.config/tree-sitter`, add the following:\n  ```json\n  {\n    \"parser-directories\": [\"/path/to/your/tree-sitter-repositories\"]\n  }\n  ```\n5. Use the generated parser to parse a GDScript file, for example:\n  ```bash\n  tree-sitter parse --scope source.gdscript data/parsing_test.gd\n  ```\n\nThe `--scope` option is used to tell Tree-Sitter what language to use for parsing. In this case, `source.gdscript` is the name used to identify GDScript in the Tree-Sitter grammar. The `data/parsing_test.gd` file is a sample GDScript file that you can use to test the parser.\n\nIt should give you an output that looks like this and shows the structure of the GDScript file:\n\n```scm\n(source [0, 0] - [11, 0]\n  (comment [0, 0] - [0, 80])\n  (class_name_statement [1, 0] - [1, 18]\n    (name [1, 11] - [1, 18]))\n  (extends_statement [1, 19] - [1, 35]\n    (type [1, 27] - [1, 35]\n      (identifier [1, 27] - [1, 35])))\n  (variable_statement [3, 0] - [3, 34]\n    name: (name [3, 4] - [3, 12])\n    type: (inferred_type [3, 13] - [3, 15])\n    value: (call [3, 16] - [3, 34]\n      (identifier [3, 16] - [3, 23])\n      (arguments [3, 23] - [3, 34]\n        (integer [3, 24] - [3, 27])\n        (unary_operator [3, 29] - [3, 33]\n          (integer [3, 30] - [3, 33])))))\n; ...\n```\n\n### Understanding queries in the `.scm` files\n\nThe `.scm` files in the `languages/gdscript` folder use queries to match specific parts of the GDScript code. These queries are written in a syntax that is specific to Tree-Sitter and allow you to define patterns to match against the parsed structure of the code.\n\nFor example, a query might look like this:\n\n```scm\n(source\n    (variable_statement .\n        \"var\" @context\n        name: (_) @name\n    ) @item)\n```\n\nThis means: Capture/find a variable definition that is a direct child of the source node. The `@context`, `@name`, and `@item` are types of directives that Zed uses to know what to do with the matched nodes:\n\n- `@context` is used to indicate what this is (in this case, a \"var\")\n- `@name` captures the name of the symbol (in this case, the variable's name in the source code)\n- `@item` captures the entire variable statement with its name and context so that when you click on it in Zed, it can take you to the right place in the code\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdquest%2Fzed-gdscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgdquest%2Fzed-gdscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdquest%2Fzed-gdscript/lists"}