feat: add GDScript (Godot) as a supported language#316
Merged
tirth8205 merged 1 commit intotirth8205:mainfrom Apr 18, 2026
Merged
feat: add GDScript (Godot) as a supported language#316tirth8205 merged 1 commit intotirth8205:mainfrom
tirth8205 merged 1 commit intotirth8205:mainfrom
Conversation
Contributor
Author
|
@tirth8205 Can you please review? This is a base PR that support the language and I will create a few more to cover sources and scenes files soon |
3 tasks
Open
7 tasks
This was referenced Apr 21, 2026
npkriami18
pushed a commit
to npkriami18/code-review-graph
that referenced
this pull request
Apr 21, 2026
(cherry picked from commit 112a442)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds GDScript — the scripting language for the Godot Engine — as a fully supported language in code-review-graph. GDScript uses the tree-sitter-gdscript grammar, already shipped in
tree-sitter-language-packasgdscript.abi3.so, so no new dependencies are required..gdfiles are now parsed end-to-end: classes, functions,extendsparent-class imports, and method calls all land in the graph.What changed
code_review_graph/parser.py".gd": "gdscript"toEXTENSION_TO_LANGUAGE"gdscript": ["class_definition", "class_name_statement"]to_CLASS_TYPES— covers inner classes (class Name:) and the file-levelclass_name Nameidentity declaration"gdscript": ["function_definition"]to_FUNCTION_TYPES— coversfunc,static func, and annotated@onready func"gdscript": ["extends_statement"]to_IMPORT_TYPES— treats the parent class / script path as a hard import dependency"gdscript": ["call", "attribute_call"]to_CALL_TYPES— bare calls producecall;obj.method()is anattributenode whose right-hand side is anattribute_callgdscriptbranch to_extract_import()that resolvesextends Node(type → identifier),extends "res://path.gd"(string literal), andextends SomeClass.Nested(type node)tests/test_multilang.pyTestGDScriptParsingclass with 10 unit tests covering: language detection,class_nameextraction, inner-class extraction, top-level & inner-class function extraction,extends→ IMPORTS_FROM edge, direct and attribute method calls, qualified-name resolution for same-file calls, and CONTAINS edge wiring for both the file and the inner classtests/fixtures/sample.gdextends Node,class_name,const preload(...),signal,@export/@onreadyannotations, inner class with its own method, bare calls, attribute calls, andstatic funcCHANGELOG.md[Unreleased]Node-type mapping
_CLASS_TYPESclass_definition,class_name_statementclass X:+ file-levelclass_name X_FUNCTION_TYPESfunction_definitionstatic funcand annotated funcs_IMPORT_TYPESextends_statement_CALL_TYPEScall,attribute_callattribute_calllives inside anattributenode forobj.method()The generic
_get_name()handler already covers GDScript —class_definition,class_name_statement, andfunction_definitionall expose a child of typename— so no changes were needed to name extraction.How to test
Local run: 10 new tests pass, 234 parser/multilang tests pass in total,
ruffclean.Usage
Example queries that now work on a Godot codebase:
get_impact_radius_tool({target: "ItemsManager.add_main_grid_item"})— blast radius before editing a manager methodquery_graph_tool({pattern: "callers_of", name: "_ready"})— find every scene that overrides_readysemantic_search_nodes_tool({query: "merge two items"})— locate the merge logic by conceptKnown gaps / future work
preload("res://x.gd")andload("res://x.gd")currently show up asCALLSedges with targetpreload/load. Promoting them toIMPORTS_FROMwould require a bespoke_extract_gdscript_constructshook (mirroring_extract_lua_constructs). Left out to keep this PR minimal..tscn(scene) and.tres(resource) files carry real cross-file dependencies via[ext_resource path="..."], but they have no tree-sitter grammar. A follow-up PR can add a regex-based handler — same pattern as_parse_notebook/_parse_databricks_py_notebook.signaldeclarations are not modeled (no semantic role fits). They could be added asTypenodes later if signal-aware review becomes useful.