tree-sitter-analyzer 1.4.0__py3-none-any.whl → 1.5.0__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/__init__.py +1 -1
- tree_sitter_analyzer/api.py +108 -8
- tree_sitter_analyzer/cli/commands/find_and_grep_cli.py +3 -2
- tree_sitter_analyzer/cli/commands/list_files_cli.py +0 -1
- tree_sitter_analyzer/cli/commands/search_content_cli.py +3 -2
- tree_sitter_analyzer/encoding_utils.py +3 -3
- tree_sitter_analyzer/formatters/formatter_factory.py +3 -0
- tree_sitter_analyzer/formatters/javascript_formatter.py +467 -0
- tree_sitter_analyzer/language_loader.py +2 -2
- tree_sitter_analyzer/languages/javascript_plugin.py +1289 -238
- tree_sitter_analyzer/mcp/tools/find_and_grep_tool.py +17 -4
- tree_sitter_analyzer/mcp/utils/path_resolver.py +1 -1
- tree_sitter_analyzer/models.py +9 -0
- tree_sitter_analyzer/queries/javascript.py +592 -31
- {tree_sitter_analyzer-1.4.0.dist-info → tree_sitter_analyzer-1.5.0.dist-info}/METADATA +106 -18
- {tree_sitter_analyzer-1.4.0.dist-info → tree_sitter_analyzer-1.5.0.dist-info}/RECORD +18 -17
- {tree_sitter_analyzer-1.4.0.dist-info → tree_sitter_analyzer-1.5.0.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-1.4.0.dist-info → tree_sitter_analyzer-1.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -335,23 +335,36 @@ class FindAndGrepTool(BaseMCPTool):
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
# rg step on files list
|
|
338
|
-
#
|
|
338
|
+
# Create specific file globs to limit search to only the files found by fd
|
|
339
339
|
from pathlib import Path
|
|
340
340
|
|
|
341
341
|
parent_dirs = set()
|
|
342
|
+
file_globs = []
|
|
343
|
+
|
|
342
344
|
for file_path in files:
|
|
343
|
-
|
|
345
|
+
parent_dir = str(Path(file_path).parent)
|
|
346
|
+
parent_dirs.add(parent_dir)
|
|
347
|
+
|
|
348
|
+
# Create a specific glob pattern for this exact file
|
|
349
|
+
file_name = Path(file_path).name
|
|
350
|
+
# Escape special characters in filename for glob pattern
|
|
351
|
+
escaped_name = file_name.replace("[", "[[]").replace("]", "[]]")
|
|
352
|
+
file_globs.append(escaped_name)
|
|
344
353
|
|
|
345
|
-
# Use parent directories as roots
|
|
354
|
+
# Use parent directories as roots but limit to specific files via globs
|
|
346
355
|
rg_roots = list(parent_dirs)
|
|
347
356
|
|
|
357
|
+
# Combine user-provided include_globs with our file-specific globs
|
|
358
|
+
combined_include_globs = arguments.get("include_globs", []) or []
|
|
359
|
+
combined_include_globs.extend(file_globs)
|
|
360
|
+
|
|
348
361
|
rg_cmd = fd_rg_utils.build_rg_command(
|
|
349
362
|
query=arguments["query"],
|
|
350
363
|
case=arguments.get("case", "smart"),
|
|
351
364
|
fixed_strings=bool(arguments.get("fixed_strings", False)),
|
|
352
365
|
word=bool(arguments.get("word", False)),
|
|
353
366
|
multiline=bool(arguments.get("multiline", False)),
|
|
354
|
-
include_globs=
|
|
367
|
+
include_globs=combined_include_globs,
|
|
355
368
|
exclude_globs=arguments.get("exclude_globs"),
|
|
356
369
|
follow_symlinks=bool(arguments.get("follow_symlinks", False)),
|
|
357
370
|
hidden=bool(arguments.get("hidden", False)),
|
|
@@ -52,7 +52,7 @@ def _normalize_path_cross_platform(path_str: str) -> str:
|
|
|
52
52
|
from ctypes import wintypes
|
|
53
53
|
|
|
54
54
|
# GetLongPathNameW function
|
|
55
|
-
_GetLongPathNameW = ctypes.windll.kernel32.GetLongPathNameW
|
|
55
|
+
_GetLongPathNameW = ctypes.windll.kernel32.GetLongPathNameW # type: ignore[attr-defined]
|
|
56
56
|
_GetLongPathNameW.argtypes = [
|
|
57
57
|
wintypes.LPCWSTR,
|
|
58
58
|
wintypes.LPWSTR,
|
tree_sitter_analyzer/models.py
CHANGED
|
@@ -67,6 +67,11 @@ class Function(CodeElement):
|
|
|
67
67
|
complexity_score: int = 1
|
|
68
68
|
is_abstract: bool = False
|
|
69
69
|
is_final: bool = False
|
|
70
|
+
# JavaScript-specific fields
|
|
71
|
+
is_generator: bool = False
|
|
72
|
+
is_arrow: bool = False
|
|
73
|
+
is_method: bool = False
|
|
74
|
+
framework_type: str | None = None
|
|
70
75
|
|
|
71
76
|
|
|
72
77
|
@dataclass(frozen=False)
|
|
@@ -90,6 +95,10 @@ class Class(CodeElement):
|
|
|
90
95
|
implements_interfaces: list[str] = field(
|
|
91
96
|
default_factory=list
|
|
92
97
|
) # Alias for interfaces
|
|
98
|
+
# JavaScript-specific fields
|
|
99
|
+
is_react_component: bool = False
|
|
100
|
+
framework_type: str | None = None
|
|
101
|
+
is_exported: bool = False
|
|
93
102
|
|
|
94
103
|
|
|
95
104
|
@dataclass(frozen=False)
|