From 68710c7ac019d9f9682242533fe5c098c93388d4 Mon Sep 17 00:00:00 2001 From: Wolfvin Date: Tue, 7 Jul 2026 05:56:57 +0000 Subject: [PATCH] feat(languages): add Go, Java, PHP, Ruby, C/C++ tree-sitter support (closes #198) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add 6 new language entries to node_types.yaml: - Go: function_declaration, method_declaration, struct_type, interface_type, import_declaration, call_expression, etc. - Java: method_declaration, constructor_declaration, class_declaration, interface_declaration, enum_declaration, method_invocation, etc. - PHP: function_definition, method_declaration, class_declaration, include_expression, use_declaration, function_call_expression, etc. - Ruby: method, singleton_method, class, module, require, call, etc. - C: function_definition, struct_specifier, union_specifier, enum_specifier, preproc_include, call_expression, type_definition, etc. - C++: function_definition, class_specifier, struct_specifier, preproc_include, using_declaration, call_expression, namespace_definition, template_declaration, type_alias_declaration, etc. Each language has minimum 4 required categories: function_def, class_def, import, call. Additional categories added where the language has unique constructs (e.g. Java annotations, PHP namespaces, C++ templates). Grammar packages added to pyproject.toml [project.optional-dependencies] grammars: tree-sitter-go, tree-sitter-java, tree-sitter-php, tree-sitter-ruby, tree-sitter-c, tree-sitter-cpp. Verified: codelens scan on test fixture with all 6 languages — 6 files detected (go:1, java:1, php:1, ruby:1, c_cpp:2), 12 backend nodes, 0 crashes. get_supported_languages() returns 13 languages (7 existing + 6 new). Definition of Done (issue #198): - [x] node_types.yaml has entries for Go, Java, PHP, Ruby, C, C++ - [x] Each entry has minimal 4 categories: function, class, import, call - [x] Grammar packages added to pyproject.toml - [x] codelens scan does not crash on new languages - [x] Files in new languages are detected and scanned (not skipped) --- pyproject.toml | 7 ++ scripts/languages/node_types.yaml | 135 ++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 14a9922..5805a2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,13 @@ grammars = [ "tree-sitter-typescript", "tree-sitter-rust", "tree-sitter-python", + # Issue #198: 5 new languages + "tree-sitter-go", + "tree-sitter-java", + "tree-sitter-php", + "tree-sitter-ruby", + "tree-sitter-c", + "tree-sitter-cpp", ] watch = [ "watchdog", diff --git a/scripts/languages/node_types.yaml b/scripts/languages/node_types.yaml index fd15261..d512c4c 100644 --- a/scripts/languages/node_types.yaml +++ b/scripts/languages/node_types.yaml @@ -156,3 +156,138 @@ css: html: attribute: - attribute + +# ─── Go (issue #198) ──────────────────────────────────────────────── +go: + function_def: + - function_declaration + - method_declaration + class_def: + - struct_type + - interface_type + import: + - import_declaration + call: + - call_expression + type_alias: + - type_declaration + const: + - const_declaration + - var_declaration + identifier: + - identifier + - field_identifier + - package_identifier + - selector_expression + +# ─── Java (issue #198) ────────────────────────────────────────────── +java: + function_def: + - method_declaration + - constructor_declaration + class_def: + - class_declaration + - interface_declaration + - enum_declaration + - record_declaration + import: + - import_declaration + call: + - method_invocation + annotation: + - annotation + - marker_annotation + field: + - field_declaration + identifier: + - identifier + - scoped_identifier + - field_access + +# ─── PHP (issue #198) ─────────────────────────────────────────────── +php: + function_def: + - function_definition + - method_declaration + class_def: + - class_declaration + - interface_declaration + - trait_declaration + import: + - include_expression + - require_expression + - use_declaration + call: + - function_call_expression + - method_call_expression + namespace: + - namespace_declaration + identifier: + - name + - scoped_call_expression + - member_access_expression + +# ─── Ruby (issue #198) ────────────────────────────────────────────── +ruby: + function_def: + - method + - singleton_method + class_def: + - class + - module + import: + - require + - require_relative + call: + - call + identifier: + - identifier + - constant + - scope_resolution + +# ─── C (issue #198) ───────────────────────────────────────────────── +c: + function_def: + - function_definition + class_def: + - struct_specifier + - union_specifier + - enum_specifier + import: + - preproc_include + call: + - call_expression + type_alias: + - type_definition + identifier: + - identifier + - field_identifier + - type_identifier + +# ─── C++ (issue #198) ─────────────────────────────────────────────── +cpp: + function_def: + - function_definition + class_def: + - class_specifier + - struct_specifier + - union_specifier + - enum_specifier + import: + - preproc_include + - using_declaration + call: + - call_expression + namespace: + - namespace_definition + template: + - template_declaration + type_alias: + - type_alias_declaration + - type_definition + identifier: + - identifier + - field_identifier + - type_identifier + - qualified_identifier + - scoped_identifier