tree-sitter-analyzer 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tree-sitter-analyzer might be problematic. Click here for more details.
- tree_sitter_analyzer/core/engine.py +7 -0
- tree_sitter_analyzer/languages/java_plugin.py +28 -0
- {tree_sitter_analyzer-0.6.0.dist-info → tree_sitter_analyzer-0.6.2.dist-info}/METADATA +8 -8
- {tree_sitter_analyzer-0.6.0.dist-info → tree_sitter_analyzer-0.6.2.dist-info}/RECORD +6 -6
- {tree_sitter_analyzer-0.6.0.dist-info → tree_sitter_analyzer-0.6.2.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-0.6.0.dist-info → tree_sitter_analyzer-0.6.2.dist-info}/entry_points.txt +0 -0
|
@@ -301,6 +301,13 @@ class AnalysisEngine:
|
|
|
301
301
|
# Extract different types of elements
|
|
302
302
|
elements = []
|
|
303
303
|
|
|
304
|
+
# Extract packages first (needed for proper class package resolution)
|
|
305
|
+
if hasattr(extractor, "extract_packages"):
|
|
306
|
+
packages = extractor.extract_packages(
|
|
307
|
+
parse_result.tree, parse_result.source_code
|
|
308
|
+
)
|
|
309
|
+
elements.extend(packages)
|
|
310
|
+
|
|
304
311
|
# Extract functions/methods
|
|
305
312
|
if hasattr(extractor, "extract_functions"):
|
|
306
313
|
functions = extractor.extract_functions(
|
|
@@ -100,6 +100,12 @@ class JavaElementExtractor(ElementExtractor):
|
|
|
100
100
|
self.content_lines = source_code.split("\n")
|
|
101
101
|
self._reset_caches()
|
|
102
102
|
|
|
103
|
+
# Ensure package information is extracted before processing classes
|
|
104
|
+
# This fixes the issue where current_package is empty when extract_classes
|
|
105
|
+
# is called independently or before extract_imports
|
|
106
|
+
if not self.current_package:
|
|
107
|
+
self._extract_package_from_tree(tree)
|
|
108
|
+
|
|
103
109
|
classes: list[Class] = []
|
|
104
110
|
|
|
105
111
|
# Use AdvancedAnalyzer's optimized traversal
|
|
@@ -754,6 +760,22 @@ class JavaElementExtractor(ElementExtractor):
|
|
|
754
760
|
log_error(f"Unexpected error in package element extraction: {e}")
|
|
755
761
|
return None
|
|
756
762
|
|
|
763
|
+
def _extract_package_from_tree(self, tree: "tree_sitter.Tree") -> None:
|
|
764
|
+
"""
|
|
765
|
+
Extract package information from the tree and set current_package.
|
|
766
|
+
|
|
767
|
+
This method ensures that package information is available for class extraction
|
|
768
|
+
regardless of the order in which extraction methods are called.
|
|
769
|
+
"""
|
|
770
|
+
try:
|
|
771
|
+
# Look for package declaration in the root node's children
|
|
772
|
+
for child in tree.root_node.children:
|
|
773
|
+
if child.type == "package_declaration":
|
|
774
|
+
self._extract_package_info(child)
|
|
775
|
+
break # Only one package declaration per file
|
|
776
|
+
except Exception as e:
|
|
777
|
+
log_debug(f"Failed to extract package from tree: {e}")
|
|
778
|
+
|
|
757
779
|
def _determine_visibility(self, modifiers: list[str]) -> str:
|
|
758
780
|
"""Determine visibility from modifiers"""
|
|
759
781
|
if "public" in modifiers:
|
|
@@ -1113,6 +1135,10 @@ class JavaPlugin(LanguagePlugin):
|
|
|
1113
1135
|
extractor = self.create_extractor()
|
|
1114
1136
|
|
|
1115
1137
|
if parse_result.tree:
|
|
1138
|
+
log_debug("Java Plugin: Extracting packages...")
|
|
1139
|
+
packages = extractor.extract_packages(parse_result.tree, source_code)
|
|
1140
|
+
log_debug(f"Java Plugin: Found {len(packages)} packages")
|
|
1141
|
+
|
|
1116
1142
|
log_debug("Java Plugin: Extracting functions...")
|
|
1117
1143
|
functions = extractor.extract_functions(parse_result.tree, source_code)
|
|
1118
1144
|
log_debug(f"Java Plugin: Found {len(functions)} functions")
|
|
@@ -1129,6 +1155,7 @@ class JavaPlugin(LanguagePlugin):
|
|
|
1129
1155
|
imports = extractor.extract_imports(parse_result.tree, source_code)
|
|
1130
1156
|
log_debug(f"Java Plugin: Found {len(imports)} imports")
|
|
1131
1157
|
else:
|
|
1158
|
+
packages = []
|
|
1132
1159
|
functions = []
|
|
1133
1160
|
classes = []
|
|
1134
1161
|
variables = []
|
|
@@ -1136,6 +1163,7 @@ class JavaPlugin(LanguagePlugin):
|
|
|
1136
1163
|
|
|
1137
1164
|
# Combine all elements
|
|
1138
1165
|
all_elements: list[CodeElement] = []
|
|
1166
|
+
all_elements.extend(packages)
|
|
1139
1167
|
all_elements.extend(functions)
|
|
1140
1168
|
all_elements.extend(classes)
|
|
1141
1169
|
all_elements.extend(variables)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tree-sitter-analyzer
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture
|
|
5
5
|
Project-URL: Homepage, https://github.com/aimasteracc/tree-sitter-analyzer
|
|
6
6
|
Project-URL: Documentation, https://github.com/aimasteracc/tree-sitter-analyzer#readme
|
|
@@ -294,17 +294,17 @@ uv add "tree-sitter-analyzer[all,mcp]"
|
|
|
294
294
|
### For Developers
|
|
295
295
|
```bash
|
|
296
296
|
# Clone and install for development
|
|
297
|
-
git clone https://github.com/
|
|
297
|
+
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
298
298
|
cd tree-sitter-analyzer
|
|
299
299
|
uv sync --extra all --extra mcp
|
|
300
300
|
```
|
|
301
301
|
|
|
302
302
|
## 📚 Documentation
|
|
303
303
|
|
|
304
|
-
- **[MCP Setup Guide for Users](https://github.com/
|
|
305
|
-
- **[MCP Setup Guide for Developers](https://github.com/
|
|
306
|
-
- **[API Documentation](https://github.com/
|
|
307
|
-
- **[Contributing Guide](https://github.com/
|
|
304
|
+
- **[MCP Setup Guide for Users](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_USERS.md)** - Simple setup for AI assistant users
|
|
305
|
+
- **[MCP Setup Guide for Developers](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_DEVELOPERS.md)** - Local development configuration
|
|
306
|
+
- **[API Documentation](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/docs/api.md)** - Detailed API reference
|
|
307
|
+
- **[Contributing Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CONTRIBUTING.md)** - How to contribute
|
|
308
308
|
|
|
309
309
|
## 🧪 Testing
|
|
310
310
|
|
|
@@ -324,7 +324,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
324
324
|
|
|
325
325
|
## 🤝 Contributing
|
|
326
326
|
|
|
327
|
-
We welcome contributions! Please see our [Contributing Guide](https://github.com/
|
|
327
|
+
We welcome contributions! Please see our [Contributing Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CONTRIBUTING.md) for details.
|
|
328
328
|
|
|
329
329
|
### 🤖 AI/LLM Collaboration
|
|
330
330
|
|
|
@@ -339,7 +339,7 @@ python llm_code_checker.py --check-all
|
|
|
339
339
|
python llm_code_checker.py path/to/new_file.py
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
📖 **See our [AI Collaboration Guide](https://github.com/
|
|
342
|
+
📖 **See our [AI Collaboration Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/AI_COLLABORATION_GUIDE.md) and [LLM Coding Guidelines](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/LLM_CODING_GUIDELINES.md) for detailed instructions on working with AI systems.**
|
|
343
343
|
|
|
344
344
|
---
|
|
345
345
|
|
|
@@ -27,7 +27,7 @@ tree_sitter_analyzer/cli/commands/table_command.py,sha256=EtMVI_Ui1wTblcDpSHWVOv
|
|
|
27
27
|
tree_sitter_analyzer/core/__init__.py,sha256=VlYOy1epW16vjaVd__knESewnU0sfXF9a4hjrFxiSEE,440
|
|
28
28
|
tree_sitter_analyzer/core/analysis_engine.py,sha256=ReWaW-ZtuyKwtR-XdVd8J-A0oN5tWmKUEyZS6LJJa8E,18567
|
|
29
29
|
tree_sitter_analyzer/core/cache_service.py,sha256=TQrOI9xwI-0KRF8c6-cXwXM1Ut3AhLOXa4GpyQsIHW4,9624
|
|
30
|
-
tree_sitter_analyzer/core/engine.py,sha256=
|
|
30
|
+
tree_sitter_analyzer/core/engine.py,sha256=VFXGowDj6EfjFSh2MQDkQIc-4ISXaOg38n4lUhVY5Os,18721
|
|
31
31
|
tree_sitter_analyzer/core/parser.py,sha256=qT3yIlTRdod4tf_2o1hU_B-GYGukyM2BtaFxzSoxois,9293
|
|
32
32
|
tree_sitter_analyzer/core/query.py,sha256=fmuPMLsU4XUnMViaQADPRPoiZ-MzeE2k_e9N35VBNSA,16899
|
|
33
33
|
tree_sitter_analyzer/formatters/__init__.py,sha256=yVb4HF_4EEPRwTf3y3-vM2NllrhykG3zlvQhN-6dB4c,31
|
|
@@ -41,7 +41,7 @@ tree_sitter_analyzer/interfaces/cli_adapter.py,sha256=ANl2kEirv5_mf87dlZRZvMp_oq
|
|
|
41
41
|
tree_sitter_analyzer/interfaces/mcp_adapter.py,sha256=DJugCRVL-AR6gJRaRrBW5JVXRvfl_iiRjupcnsb0_sE,7111
|
|
42
42
|
tree_sitter_analyzer/interfaces/mcp_server.py,sha256=TvcmWWRxyWp5LrbDRGAeTZww_mmyarA8Mz9eL5xiQv0,16200
|
|
43
43
|
tree_sitter_analyzer/languages/__init__.py,sha256=VTXxJgVjHJAciLhX0zzXOS4EygZMtebeYUbi_0z6fGw,340
|
|
44
|
-
tree_sitter_analyzer/languages/java_plugin.py,sha256=
|
|
44
|
+
tree_sitter_analyzer/languages/java_plugin.py,sha256=o_9F_anKCemnUDV6hq28RatRmBm3e0nchcQZ-v0nDv4,48454
|
|
45
45
|
tree_sitter_analyzer/languages/javascript_plugin.py,sha256=k14kHfi5II9MRTsVuy0NQq5l2KZYncCnM1Q6T1c5q_U,15844
|
|
46
46
|
tree_sitter_analyzer/languages/python_plugin.py,sha256=MJ03F_Nv-nmInIkEFmPyEXYhyGbLHyr5kCbj2taEDYk,29144
|
|
47
47
|
tree_sitter_analyzer/mcp/__init__.py,sha256=76ZKgWbsXZWB8mNER2D0fNHdULPZhqqBJHi8R0uHDPE,721
|
|
@@ -66,7 +66,7 @@ tree_sitter_analyzer/queries/java.py,sha256=NZTSzFADlGrm3MD0oIkOdkN_6wP2pGZpNs0R
|
|
|
66
66
|
tree_sitter_analyzer/queries/javascript.py,sha256=pnXrgISwDE5GhPHDbUKEGI3thyLmebTeQt-l_-x4qT8,3962
|
|
67
67
|
tree_sitter_analyzer/queries/python.py,sha256=L33KRUyV3sAvA3_HFkPyGgtiq0ygSpNY_n2YojodPlc,7570
|
|
68
68
|
tree_sitter_analyzer/queries/typescript.py,sha256=eersyAF7TladuCWa8WE_-cO9YTF1LUSjLIl-tk2fZDo,6708
|
|
69
|
-
tree_sitter_analyzer-0.6.
|
|
70
|
-
tree_sitter_analyzer-0.6.
|
|
71
|
-
tree_sitter_analyzer-0.6.
|
|
72
|
-
tree_sitter_analyzer-0.6.
|
|
69
|
+
tree_sitter_analyzer-0.6.2.dist-info/METADATA,sha256=lkgv431sXkEnLiLoZuK47muCiKqmEJqYPySwZAXyA8E,13410
|
|
70
|
+
tree_sitter_analyzer-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
71
|
+
tree_sitter_analyzer-0.6.2.dist-info/entry_points.txt,sha256=EA0Ow27x2SqNt2300sv70RTWxKRIxJzOhNPIVlez4NM,417
|
|
72
|
+
tree_sitter_analyzer-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
{tree_sitter_analyzer-0.6.0.dist-info → tree_sitter_analyzer-0.6.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|