siada-cli 0.0.1__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.
- agent_config.yaml +34 -0
- siada/__init__.py +13 -0
- siada/agent_hub/__init__.py +10 -0
- siada/agent_hub/coder/bug_fix_agent.py +398 -0
- siada/agent_hub/coder/code_gen_agent.py +235 -0
- siada/agent_hub/coder/fe_gen_agent.py +37 -0
- siada/agent_hub/coder/issue_review_agent.py +68 -0
- siada/agent_hub/coder/prompt/__init__.py +0 -0
- siada/agent_hub/coder/prompt/base/__init__.py +0 -0
- siada/agent_hub/coder/prompt/base/capabilities.py +18 -0
- siada/agent_hub/coder/prompt/base/non_interactive.py +14 -0
- siada/agent_hub/coder/prompt/base/prompt_builder.py +33 -0
- siada/agent_hub/coder/prompt/base/rules.py +40 -0
- siada/agent_hub/coder/prompt/base/tool_use.py +14 -0
- siada/agent_hub/coder/prompt/bug_prompt/bug_fix_prompt.py +51 -0
- siada/agent_hub/coder/prompt/bug_prompt/rules.py +53 -0
- siada/agent_hub/coder/prompt/code_gen_prompt.py +45 -0
- siada/agent_hub/coder/prompt/fe_gen_prompt.py +45 -0
- siada/agent_hub/coder/prompt/issue_review_prompt.py +121 -0
- siada/agent_hub/coder/tracing/__init__.py +22 -0
- siada/agent_hub/coder/tracing/logger_tracing_processor.py +458 -0
- siada/agent_hub/hooks/__init__.py +0 -0
- siada/agent_hub/hooks/io_hooks.py +30 -0
- siada/agent_hub/siada_agent.py +214 -0
- siada/config/__init__.py +0 -0
- siada/config/config_loader.py +67 -0
- siada/entrypoint/__init__.py +3 -0
- siada/entrypoint/args_parser/__init__.py +0 -0
- siada/entrypoint/args_parser/args.py +195 -0
- siada/entrypoint/interaction/__init__.py +0 -0
- siada/entrypoint/interaction/base_turn.py +107 -0
- siada/entrypoint/interaction/config.py +30 -0
- siada/entrypoint/interaction/controller.py +122 -0
- siada/entrypoint/interaction/nointeractive_controller.py +27 -0
- siada/entrypoint/interaction/turn/interface.py +116 -0
- siada/entrypoint/interaction/turn/models.py +34 -0
- siada/entrypoint/interaction/turn/run_turn.py +641 -0
- siada/entrypoint/interaction/turn_factory.py +35 -0
- siada/entrypoint/interaction/turn_models.py +28 -0
- siada/entrypoint/siadahub.py +413 -0
- siada/foundation/__init__.py +0 -0
- siada/foundation/code_agent_context.py +48 -0
- siada/foundation/config.py +59 -0
- siada/foundation/constants.py +2 -0
- siada/foundation/context.py +76 -0
- siada/foundation/logging.py +341 -0
- siada/foundation/tools/__init__.py +0 -0
- siada/foundation/tools/get_git_diff.py +105 -0
- siada/io/__init__.py +0 -0
- siada/io/banner.py +148 -0
- siada/io/color_settings.py +207 -0
- siada/io/color_utils.py +16 -0
- siada/io/components/__init__.py +0 -0
- siada/io/components/mdstream.py +204 -0
- siada/io/console_printer.py +68 -0
- siada/io/io.py +661 -0
- siada/io/key_bindings.py +129 -0
- siada/io/notification_command.py +40 -0
- siada/io/test_banner.py +64 -0
- siada/models/__init__.py +0 -0
- siada/models/agent.py +47 -0
- siada/models/coder/__init__.py +0 -0
- siada/models/converter.py +27 -0
- siada/models/model_base_config.py +121 -0
- siada/models/model_run_config.py +153 -0
- siada/provider/__init__.py +0 -0
- siada/provider/client_factory.py +112 -0
- siada/provider/llm_client.py +11 -0
- siada/provider/openrouter/__init__.py +0 -0
- siada/provider/openrouter/coverter.py +17 -0
- siada/provider/openrouter/openroute_provider.py +33 -0
- siada/provider/provider_factory.py +53 -0
- siada/queries/tree-sitter-language-pack/README.md +7 -0
- siada/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- siada/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- siada/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- siada/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- siada/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- siada/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- siada/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- siada/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- siada/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- siada/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- siada/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- siada/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- siada/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- siada/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- siada/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- siada/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- siada/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- siada/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- siada/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- siada/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- siada/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- siada/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- siada/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- siada/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- siada/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- siada/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- siada/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- siada/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- siada/queries/tree-sitter-languages/README.md +23 -0
- siada/queries/tree-sitter-languages/c-tags.scm +9 -0
- siada/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- siada/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- siada/queries/tree-sitter-languages/dart-tags.scm +91 -0
- siada/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- siada/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- siada/queries/tree-sitter-languages/elm-tags.scm +19 -0
- siada/queries/tree-sitter-languages/go-tags.scm +30 -0
- siada/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- siada/queries/tree-sitter-languages/java-tags.scm +20 -0
- siada/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- siada/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- siada/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- siada/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- siada/queries/tree-sitter-languages/php-tags.scm +26 -0
- siada/queries/tree-sitter-languages/python-tags.scm +12 -0
- siada/queries/tree-sitter-languages/ql-tags.scm +26 -0
- siada/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- siada/queries/tree-sitter-languages/rust-tags.scm +60 -0
- siada/queries/tree-sitter-languages/scala-tags.scm +65 -0
- siada/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- siada/services/__init__.py +30 -0
- siada/services/at_file_recommendation_design_document.md +1213 -0
- siada/services/code_context_manager.py +136 -0
- siada/services/enhanced_fix_result_check.py +546 -0
- siada/services/execution_trace_collector.py +207 -0
- siada/services/file_recommendation/__init__.py +136 -0
- siada/services/file_recommendation/core/__init__.py +17 -0
- siada/services/file_recommendation/core/completion_engine.py +351 -0
- siada/services/file_recommendation/core/config.py +62 -0
- siada/services/file_recommendation/core/file_discovery.py +353 -0
- siada/services/file_recommendation/core/suggestion.py +110 -0
- siada/services/file_recommendation/utils/__init__.py +22 -0
- siada/services/file_recommendation/utils/path_utils.py +138 -0
- siada/services/file_recommendation/utils/text_utils.py +253 -0
- siada/services/fix_result_check.py +377 -0
- siada/services/handle_at_command/README.md +247 -0
- siada/services/handle_at_command/__init__.py +115 -0
- siada/services/handle_at_command/exceptions.py +46 -0
- siada/services/handle_at_command/models.py +92 -0
- siada/services/handle_at_command/parser.py +189 -0
- siada/services/handle_at_command/processor.py +321 -0
- siada/services/handle_at_command/resolver.py +318 -0
- siada/services/handle_at_command/utils.py +345 -0
- siada/services/model_info_service.py +103 -0
- siada/services/siada_runner.py +170 -0
- siada/session/__init__.py +29 -0
- siada/session/session_manager.py +66 -0
- siada/session/session_models.py +43 -0
- siada/support/__init__.py +0 -0
- siada/support/completer.py +204 -0
- siada/support/editor.py +146 -0
- siada/support/envprocessor.py +54 -0
- siada/support/repo.py +51 -0
- siada/support/slash_commands.py +410 -0
- siada/support/spinner.py +320 -0
- siada/tools/__init__.py +0 -0
- siada/tools/ast/README.md +345 -0
- siada/tools/ast/ast_tool.py +341 -0
- siada/tools/ast/models.py +11 -0
- siada/tools/coder/__init__.py +0 -0
- siada/tools/coder/ask_followup_question.py +70 -0
- siada/tools/coder/cmd_runner.py +132 -0
- siada/tools/coder/file_operator.py +284 -0
- siada/tools/coder/file_search/README.md +223 -0
- siada/tools/coder/file_search/__init__.py +10 -0
- siada/tools/coder/file_search/bin/rg-linux-arm64 +0 -0
- siada/tools/coder/file_search/bin/rg-linux-x64 +0 -0
- siada/tools/coder/file_search/bin/rg-macos-arm64 +0 -0
- siada/tools/coder/file_search/bin/rg-macos-x64 +0 -0
- siada/tools/coder/file_search/bin/rg.exe +0 -0
- siada/tools/coder/file_search/search.py +437 -0
- siada/tools/coder/file_search/setup_package.py +150 -0
- siada/tools/coder/file_search/test_search.py +142 -0
- siada/tools/coder/files.py +147 -0
- siada/tools/coder/fix_attempt_completion.py +58 -0
- siada/tools/coder/issue_review_completion.py +29 -0
- siada/tools/coder/observation/__init__.py +0 -0
- siada/tools/coder/observation/error.py +22 -0
- siada/tools/coder/observation/file_observation.py +216 -0
- siada/tools/coder/observation/observation.py +71 -0
- siada/tools/coder/repo_map/__init__.py +157 -0
- siada/tools/coder/repo_map/dump.py +29 -0
- siada/tools/coder/repo_map/io.py +226 -0
- siada/tools/coder/repo_map/repo_map.py +881 -0
- siada/tools/coder/repo_map/special.py +203 -0
- siada/tools/coder/repo_map/token_counter.py +154 -0
- siada/tools/coder/repo_map/waiting.py +221 -0
- siada/tools/coder/reproduce_completion.py +39 -0
- siada/tools/coder/run_cmd.py +60 -0
- siada/tools/coder/test_completion.py +25 -0
- siada/tools/coder/tool_docs.py +44 -0
- siada/tools/compression_tool.py +200 -0
- siada/tools/read_many_files/README.md +220 -0
- siada/tools/read_many_files/__init__.py +25 -0
- siada/tools/read_many_files/file_processor.py +486 -0
- siada/tools/read_many_files/filters.py +326 -0
- siada/tools/read_many_files/formatters.py +204 -0
- siada/tools/read_many_files/models.py +189 -0
- siada/tools/read_many_files_tool.py +233 -0
- siada/tools/tool_call_format/__init__.py +55 -0
- siada/tools/tool_call_format/file_to_language.py +231 -0
- siada/tools/tool_call_format/formatter_factory.py +80 -0
- siada/tools/tool_call_format/formatters.py +282 -0
- siada/tools/tool_call_format/tool_call_formatter.py +54 -0
- siada/tools/web/__init__.py +0 -0
- siada/tools/web/web_crawl.py +208 -0
- siada/utils.py +194 -0
- siada_cli-0.0.1.dist-info/LICENSE +201 -0
- siada_cli-0.0.1.dist-info/METADATA +457 -0
- siada_cli-0.0.1.dist-info/RECORD +215 -0
- siada_cli-0.0.1.dist-info/WHEEL +4 -0
- siada_cli-0.0.1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
;; Method and Function declarations
|
|
2
|
+
(contract_declaration (_
|
|
3
|
+
(function_definition
|
|
4
|
+
name: (identifier) @name.definition.function) @definition.method))
|
|
5
|
+
|
|
6
|
+
(source_file
|
|
7
|
+
(function_definition
|
|
8
|
+
name: (identifier) @name.definition.function) @definition.function)
|
|
9
|
+
|
|
10
|
+
;; Contract, struct, enum and interface declarations
|
|
11
|
+
(contract_declaration
|
|
12
|
+
name: (identifier) @name.definition.class) @definition.class
|
|
13
|
+
|
|
14
|
+
(interface_declaration
|
|
15
|
+
name: (identifier) @name.definition.interface) @definition.interface
|
|
16
|
+
|
|
17
|
+
(library_declaration
|
|
18
|
+
name: (identifier) @name.definition.class) @definition.interface
|
|
19
|
+
|
|
20
|
+
(struct_declaration name: (identifier) @name.definition.class) @definition.class
|
|
21
|
+
(enum_declaration name: (identifier) @name.definition.class) @definition.class
|
|
22
|
+
(event_definition name: (identifier) @name.definition.class) @definition.class
|
|
23
|
+
|
|
24
|
+
;; Function calls
|
|
25
|
+
(call_expression (expression (identifier)) @name.reference.call ) @reference.call
|
|
26
|
+
|
|
27
|
+
(call_expression
|
|
28
|
+
(expression (member_expression
|
|
29
|
+
property: (_) @name.reference.method ))) @reference.call
|
|
30
|
+
|
|
31
|
+
;; Log emit
|
|
32
|
+
(emit_statement name: (_) @name.reference.class) @reference.class
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
;; Inheritance
|
|
36
|
+
|
|
37
|
+
(inheritance_specifier
|
|
38
|
+
ancestor: (user_defined_type (_) @name.reference.class . )) @reference.class
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
;; Imports ( note that unknown is not standardised )
|
|
42
|
+
(import_directive
|
|
43
|
+
import_name: (_) @name.reference.module ) @reference.unknown
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(class_declaration
|
|
2
|
+
name: (type_identifier) @name.definition.class) @definition.class
|
|
3
|
+
|
|
4
|
+
(protocol_declaration
|
|
5
|
+
name: (type_identifier) @name.definition.interface) @definition.interface
|
|
6
|
+
|
|
7
|
+
(class_declaration
|
|
8
|
+
(class_body
|
|
9
|
+
[
|
|
10
|
+
(function_declaration
|
|
11
|
+
name: (simple_identifier) @name.definition.method
|
|
12
|
+
)
|
|
13
|
+
(subscript_declaration
|
|
14
|
+
(parameter (simple_identifier) @name.definition.method)
|
|
15
|
+
)
|
|
16
|
+
(init_declaration "init" @name.definition.method)
|
|
17
|
+
(deinit_declaration "deinit" @name.definition.method)
|
|
18
|
+
]
|
|
19
|
+
)
|
|
20
|
+
) @definition.method
|
|
21
|
+
|
|
22
|
+
(protocol_declaration
|
|
23
|
+
(protocol_body
|
|
24
|
+
[
|
|
25
|
+
(protocol_function_declaration
|
|
26
|
+
name: (simple_identifier) @name.definition.method
|
|
27
|
+
)
|
|
28
|
+
(subscript_declaration
|
|
29
|
+
(parameter (simple_identifier) @name.definition.method)
|
|
30
|
+
)
|
|
31
|
+
(init_declaration "init" @name.definition.method)
|
|
32
|
+
]
|
|
33
|
+
)
|
|
34
|
+
) @definition.method
|
|
35
|
+
|
|
36
|
+
(class_declaration
|
|
37
|
+
(class_body
|
|
38
|
+
[
|
|
39
|
+
(property_declaration
|
|
40
|
+
(pattern (simple_identifier) @name.definition.property)
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
) @definition.property
|
|
45
|
+
|
|
46
|
+
(property_declaration
|
|
47
|
+
(pattern (simple_identifier) @name.definition.property)
|
|
48
|
+
) @definition.property
|
|
49
|
+
|
|
50
|
+
(function_declaration
|
|
51
|
+
name: (simple_identifier) @name.definition.function) @definition.function
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(assignment
|
|
2
|
+
key: "LABEL"
|
|
3
|
+
(value
|
|
4
|
+
(content) @name.definition.label)) @definition.label
|
|
5
|
+
|
|
6
|
+
(assignment
|
|
7
|
+
key: "GOTO"
|
|
8
|
+
(value
|
|
9
|
+
(content) @name.reference.label)) @reference.label
|
|
10
|
+
|
|
11
|
+
(assignment
|
|
12
|
+
key: "ENV"
|
|
13
|
+
(env_var) @name.definition.variable) @definition.variable
|
|
14
|
+
|
|
15
|
+
(match
|
|
16
|
+
key: "ENV"
|
|
17
|
+
(env_var) @name.reference.variable) @reference.variable
|
|
18
|
+
|
|
19
|
+
(var_sub
|
|
20
|
+
(env_var) @name.reference.variable) @reference.variable
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# Credits
|
|
3
|
+
|
|
4
|
+
Siada uses modified versions of the tags.scm files from these open source
|
|
5
|
+
tree-sitter language implementations:
|
|
6
|
+
|
|
7
|
+
* [https://github.com/tree-sitter/tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) — licensed under the MIT License.
|
|
8
|
+
* [https://github.com/tree-sitter/tree-sitter-c-sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) — licensed under the MIT License.
|
|
9
|
+
* [https://github.com/tree-sitter/tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp) — licensed under the MIT License.
|
|
10
|
+
* [https://github.com/Wilfred/tree-sitter-elisp](https://github.com/Wilfred/tree-sitter-elisp) — licensed under the MIT License.
|
|
11
|
+
* [https://github.com/elixir-lang/tree-sitter-elixir](https://github.com/elixir-lang/tree-sitter-elixir) — licensed under the Apache License, Version 2.0.
|
|
12
|
+
* [https://github.com/elm-tooling/tree-sitter-elm](https://github.com/elm-tooling/tree-sitter-elm) — licensed under the MIT License.
|
|
13
|
+
* [https://github.com/tree-sitter/tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) — licensed under the MIT License.
|
|
14
|
+
* [https://github.com/tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) — licensed under the MIT License.
|
|
15
|
+
* [https://github.com/tree-sitter/tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) — licensed under the MIT License.
|
|
16
|
+
* [https://github.com/tree-sitter/tree-sitter-ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) — licensed under the MIT License.
|
|
17
|
+
* [https://github.com/tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php) — licensed under the MIT License.
|
|
18
|
+
* [https://github.com/tree-sitter/tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) — licensed under the MIT License.
|
|
19
|
+
* [https://github.com/tree-sitter/tree-sitter-ql](https://github.com/tree-sitter/tree-sitter-ql) — licensed under the MIT License.
|
|
20
|
+
* [https://github.com/r-lib/tree-sitter-r](https://github.com/r-lib/tree-sitter-r) — licensed under the MIT License.
|
|
21
|
+
* [https://github.com/tree-sitter/tree-sitter-ruby](https://github.com/tree-sitter/tree-sitter-ruby) — licensed under the MIT License.
|
|
22
|
+
* [https://github.com/tree-sitter/tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust) — licensed under the MIT License.
|
|
23
|
+
* [https://github.com/tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) — licensed under the MIT License.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(struct_specifier name: (type_identifier) @name.definition.class body:(_)) @definition.class
|
|
2
|
+
|
|
3
|
+
(declaration type: (union_specifier name: (type_identifier) @name.definition.class)) @definition.class
|
|
4
|
+
|
|
5
|
+
(function_declarator declarator: (identifier) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
(type_definition declarator: (type_identifier) @name.definition.type) @definition.type
|
|
8
|
+
|
|
9
|
+
(enum_specifier name: (type_identifier) @name.definition.type) @definition.type
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
(class_declaration
|
|
2
|
+
name: (identifier) @name.definition.class
|
|
3
|
+
) @definition.class
|
|
4
|
+
|
|
5
|
+
(class_declaration
|
|
6
|
+
bases: (base_list (_) @name.reference.class)
|
|
7
|
+
) @reference.class
|
|
8
|
+
|
|
9
|
+
(interface_declaration
|
|
10
|
+
name: (identifier) @name.definition.interface
|
|
11
|
+
) @definition.interface
|
|
12
|
+
|
|
13
|
+
(interface_declaration
|
|
14
|
+
bases: (base_list (_) @name.reference.interface)
|
|
15
|
+
) @reference.interface
|
|
16
|
+
|
|
17
|
+
(method_declaration
|
|
18
|
+
name: (identifier) @name.definition.method
|
|
19
|
+
) @definition.method
|
|
20
|
+
|
|
21
|
+
(object_creation_expression
|
|
22
|
+
type: (identifier) @name.reference.class
|
|
23
|
+
) @reference.class
|
|
24
|
+
|
|
25
|
+
(type_parameter_constraints_clause
|
|
26
|
+
target: (identifier) @name.reference.class
|
|
27
|
+
) @reference.class
|
|
28
|
+
|
|
29
|
+
(type_constraint
|
|
30
|
+
type: (identifier) @name.reference.class
|
|
31
|
+
) @reference.class
|
|
32
|
+
|
|
33
|
+
(variable_declaration
|
|
34
|
+
type: (identifier) @name.reference.class
|
|
35
|
+
) @reference.class
|
|
36
|
+
|
|
37
|
+
(invocation_expression
|
|
38
|
+
function:
|
|
39
|
+
(member_access_expression
|
|
40
|
+
name: (identifier) @name.reference.send
|
|
41
|
+
)
|
|
42
|
+
) @reference.send
|
|
43
|
+
|
|
44
|
+
(namespace_declaration
|
|
45
|
+
name: (identifier) @name.definition.module
|
|
46
|
+
) @definition.module
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(struct_specifier name: (type_identifier) @name.definition.class body:(_)) @definition.class
|
|
2
|
+
|
|
3
|
+
(declaration type: (union_specifier name: (type_identifier) @name.definition.class)) @definition.class
|
|
4
|
+
|
|
5
|
+
(function_declarator declarator: (identifier) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
(function_declarator declarator: (field_identifier) @name.definition.function) @definition.function
|
|
8
|
+
|
|
9
|
+
(function_declarator declarator: (qualified_identifier scope: (namespace_identifier) @scope name: (identifier) @name.definition.method)) @definition.method
|
|
10
|
+
|
|
11
|
+
(type_definition declarator: (type_identifier) @name.definition.type) @definition.type
|
|
12
|
+
|
|
13
|
+
(enum_specifier name: (type_identifier) @name.definition.type) @definition.type
|
|
14
|
+
|
|
15
|
+
(class_specifier name: (type_identifier) @name.definition.class) @definition.class
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
(class_definition
|
|
2
|
+
name: (identifier) @name.definition.class) @definition.class
|
|
3
|
+
|
|
4
|
+
(method_signature
|
|
5
|
+
(function_signature)) @definition.method
|
|
6
|
+
|
|
7
|
+
(type_alias
|
|
8
|
+
(type_identifier) @name.definition.type) @definition.type
|
|
9
|
+
|
|
10
|
+
(method_signature
|
|
11
|
+
(getter_signature
|
|
12
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
13
|
+
|
|
14
|
+
(method_signature
|
|
15
|
+
(setter_signature
|
|
16
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
17
|
+
|
|
18
|
+
(method_signature
|
|
19
|
+
(function_signature
|
|
20
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
21
|
+
|
|
22
|
+
(method_signature
|
|
23
|
+
(factory_constructor_signature
|
|
24
|
+
(identifier) @name.definition.method)) @definition.method
|
|
25
|
+
|
|
26
|
+
(method_signature
|
|
27
|
+
(constructor_signature
|
|
28
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
29
|
+
|
|
30
|
+
(method_signature
|
|
31
|
+
(operator_signature)) @definition.method
|
|
32
|
+
|
|
33
|
+
(method_signature) @definition.method
|
|
34
|
+
|
|
35
|
+
(mixin_declaration
|
|
36
|
+
(mixin)
|
|
37
|
+
(identifier) @name.definition.mixin) @definition.mixin
|
|
38
|
+
|
|
39
|
+
(extension_declaration
|
|
40
|
+
name: (identifier) @name.definition.extension) @definition.extension
|
|
41
|
+
|
|
42
|
+
(enum_declaration
|
|
43
|
+
name: (identifier) @name.definition.enum) @definition.enum
|
|
44
|
+
|
|
45
|
+
(function_signature
|
|
46
|
+
name: (identifier) @name.definition.function) @definition.function
|
|
47
|
+
|
|
48
|
+
(new_expression
|
|
49
|
+
(type_identifier) @name.reference.class) @reference.class
|
|
50
|
+
|
|
51
|
+
(initialized_variable_definition
|
|
52
|
+
name: (identifier)
|
|
53
|
+
value: (identifier) @name.reference.class
|
|
54
|
+
value: (selector
|
|
55
|
+
"!"?
|
|
56
|
+
(argument_part
|
|
57
|
+
(arguments
|
|
58
|
+
(argument)*))?)?) @reference.class
|
|
59
|
+
|
|
60
|
+
(assignment_expression
|
|
61
|
+
left: (assignable_expression
|
|
62
|
+
(identifier)
|
|
63
|
+
(unconditional_assignable_selector
|
|
64
|
+
"."
|
|
65
|
+
(identifier) @name.reference.call))) @reference.call
|
|
66
|
+
|
|
67
|
+
(assignment_expression
|
|
68
|
+
left: (assignable_expression
|
|
69
|
+
(identifier)
|
|
70
|
+
(conditional_assignable_selector
|
|
71
|
+
"?."
|
|
72
|
+
(identifier) @name.reference.call))) @reference.call
|
|
73
|
+
|
|
74
|
+
((identifier) @name
|
|
75
|
+
(selector
|
|
76
|
+
"!"?
|
|
77
|
+
(conditional_assignable_selector
|
|
78
|
+
"?." (identifier) @name.reference.call)?
|
|
79
|
+
(unconditional_assignable_selector
|
|
80
|
+
"."? (identifier) @name.reference.call)?
|
|
81
|
+
(argument_part
|
|
82
|
+
(arguments
|
|
83
|
+
(argument)*))?)*
|
|
84
|
+
(cascade_section
|
|
85
|
+
(cascade_selector
|
|
86
|
+
(identifier)) @name.reference.call
|
|
87
|
+
(argument_part
|
|
88
|
+
(arguments
|
|
89
|
+
(argument)*))?)?) @reference.call
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
;; defun/defsubst
|
|
2
|
+
(function_definition name: (symbol) @name.definition.function) @definition.function
|
|
3
|
+
|
|
4
|
+
;; Treat macros as function definitions for the sake of TAGS.
|
|
5
|
+
(macro_definition name: (symbol) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
;; Match function calls
|
|
8
|
+
(list (symbol) @name.reference.function) @reference.function
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
; Definitions
|
|
2
|
+
|
|
3
|
+
; * modules and protocols
|
|
4
|
+
(call
|
|
5
|
+
target: (identifier) @ignore
|
|
6
|
+
(arguments (alias) @name.definition.module)
|
|
7
|
+
(#match? @ignore "^(defmodule|defprotocol)$")) @definition.module
|
|
8
|
+
|
|
9
|
+
; * functions/macros
|
|
10
|
+
(call
|
|
11
|
+
target: (identifier) @ignore
|
|
12
|
+
(arguments
|
|
13
|
+
[
|
|
14
|
+
; zero-arity functions with no parentheses
|
|
15
|
+
(identifier) @name.definition.function
|
|
16
|
+
; regular function clause
|
|
17
|
+
(call target: (identifier) @name.definition.function)
|
|
18
|
+
; function clause with a guard clause
|
|
19
|
+
(binary_operator
|
|
20
|
+
left: (call target: (identifier) @name.definition.function)
|
|
21
|
+
operator: "when")
|
|
22
|
+
])
|
|
23
|
+
(#match? @ignore "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @definition.function
|
|
24
|
+
|
|
25
|
+
; References
|
|
26
|
+
|
|
27
|
+
; ignore calls to kernel/special-forms keywords
|
|
28
|
+
(call
|
|
29
|
+
target: (identifier) @ignore
|
|
30
|
+
(#match? @ignore "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defmodule|defprotocol|defimpl|defstruct|defexception|defoverridable|alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
|
|
31
|
+
|
|
32
|
+
; ignore module attributes
|
|
33
|
+
(unary_operator
|
|
34
|
+
operator: "@"
|
|
35
|
+
operand: (call
|
|
36
|
+
target: (identifier) @ignore))
|
|
37
|
+
|
|
38
|
+
; * function call
|
|
39
|
+
(call
|
|
40
|
+
target: [
|
|
41
|
+
; local
|
|
42
|
+
(identifier) @name.reference.call
|
|
43
|
+
; remote
|
|
44
|
+
(dot
|
|
45
|
+
right: (identifier) @name.reference.call)
|
|
46
|
+
]) @reference.call
|
|
47
|
+
|
|
48
|
+
; * pipe into function call
|
|
49
|
+
(binary_operator
|
|
50
|
+
operator: "|>"
|
|
51
|
+
right: (identifier) @name.reference.call) @reference.call
|
|
52
|
+
|
|
53
|
+
; * modules
|
|
54
|
+
(alias) @name.reference.module @reference.module
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(value_declaration (function_declaration_left (lower_case_identifier) @name.definition.function)) @definition.function
|
|
2
|
+
|
|
3
|
+
(function_call_expr (value_expr (value_qid) @name.reference.function)) @reference.function
|
|
4
|
+
(exposed_value (lower_case_identifier) @name.reference.function) @reference.function
|
|
5
|
+
(type_annotation ((lower_case_identifier) @name.reference.function) (colon)) @reference.function
|
|
6
|
+
|
|
7
|
+
(type_declaration ((upper_case_identifier) @name.definition.type)) @definition.type
|
|
8
|
+
|
|
9
|
+
(type_ref (upper_case_qid (upper_case_identifier) @name.reference.type)) @reference.type
|
|
10
|
+
(exposed_type (upper_case_identifier) @name.reference.type) @reference.type
|
|
11
|
+
|
|
12
|
+
(type_declaration (union_variant (upper_case_identifier) @name.definition.union)) @definition.union
|
|
13
|
+
|
|
14
|
+
(value_expr (upper_case_qid (upper_case_identifier) @name.reference.union)) @reference.union
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
(module_declaration
|
|
18
|
+
(upper_case_qid (upper_case_identifier)) @name.definition.module
|
|
19
|
+
) @definition.module
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(
|
|
2
|
+
(comment)* @doc
|
|
3
|
+
.
|
|
4
|
+
(function_declaration
|
|
5
|
+
name: (identifier) @name.definition.function) @definition.function
|
|
6
|
+
(#strip! @doc "^//\\s*")
|
|
7
|
+
(#set-adjacent! @doc @definition.function)
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
(
|
|
11
|
+
(comment)* @doc
|
|
12
|
+
.
|
|
13
|
+
(method_declaration
|
|
14
|
+
name: (field_identifier) @name.definition.method) @definition.method
|
|
15
|
+
(#strip! @doc "^//\\s*")
|
|
16
|
+
(#set-adjacent! @doc @definition.method)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
(call_expression
|
|
20
|
+
function: [
|
|
21
|
+
(identifier) @name.reference.call
|
|
22
|
+
(parenthesized_expression (identifier) @name.reference.call)
|
|
23
|
+
(selector_expression field: (field_identifier) @name.reference.call)
|
|
24
|
+
(parenthesized_expression (selector_expression field: (field_identifier) @name.reference.call))
|
|
25
|
+
]) @reference.call
|
|
26
|
+
|
|
27
|
+
(type_spec
|
|
28
|
+
name: (type_identifier) @name.definition.type) @definition.type
|
|
29
|
+
|
|
30
|
+
(type_identifier) @name.reference.type @reference.type
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
;; Based on https://github.com/tree-sitter-grammars/tree-sitter-hcl/blob/main/make_grammar.js
|
|
2
|
+
;; Which has Apache 2.0 License
|
|
3
|
+
;; tags.scm for Terraform (tree-sitter-hcl)
|
|
4
|
+
|
|
5
|
+
; === Definitions: Terraform Blocks ===
|
|
6
|
+
(block
|
|
7
|
+
(identifier) @block_type
|
|
8
|
+
(string_lit (template_literal) @resource_type)
|
|
9
|
+
(string_lit (template_literal) @name.definition.resource)
|
|
10
|
+
(body) @definition.resource
|
|
11
|
+
) (#eq? @block_type "resource")
|
|
12
|
+
|
|
13
|
+
(block
|
|
14
|
+
(identifier) @block_type
|
|
15
|
+
(string_lit (template_literal) @name.definition.module)
|
|
16
|
+
(body) @definition.module
|
|
17
|
+
) (#eq? @block_type "module")
|
|
18
|
+
|
|
19
|
+
(block
|
|
20
|
+
(identifier) @block_type
|
|
21
|
+
(string_lit (template_literal) @name.definition.variable)
|
|
22
|
+
(body) @definition.variable
|
|
23
|
+
) (#eq? @block_type "variable")
|
|
24
|
+
|
|
25
|
+
(block
|
|
26
|
+
(identifier) @block_type
|
|
27
|
+
(string_lit (template_literal) @name.definition.output)
|
|
28
|
+
(body) @definition.output
|
|
29
|
+
) (#eq? @block_type "output")
|
|
30
|
+
|
|
31
|
+
(block
|
|
32
|
+
(identifier) @block_type
|
|
33
|
+
(string_lit (template_literal) @name.definition.provider)
|
|
34
|
+
(body) @definition.provider
|
|
35
|
+
) (#eq? @block_type "provider")
|
|
36
|
+
|
|
37
|
+
(block
|
|
38
|
+
(identifier) @block_type
|
|
39
|
+
(body
|
|
40
|
+
(attribute
|
|
41
|
+
(identifier) @name.definition.local
|
|
42
|
+
(expression) @definition.local
|
|
43
|
+
)+
|
|
44
|
+
)
|
|
45
|
+
) (#eq? @block_type "locals")
|
|
46
|
+
|
|
47
|
+
; === References: Variables, Locals, Modules, Data, Resources ===
|
|
48
|
+
((variable_expr) @ref_type
|
|
49
|
+
(get_attr (identifier) @name.reference.variable)
|
|
50
|
+
) @reference.variable
|
|
51
|
+
(#eq? @ref_type "var")
|
|
52
|
+
|
|
53
|
+
((variable_expr) @ref_type
|
|
54
|
+
(get_attr (identifier) @name.reference.local)
|
|
55
|
+
) @reference.local
|
|
56
|
+
(#eq? @ref_type "local")
|
|
57
|
+
|
|
58
|
+
((variable_expr) @ref_type
|
|
59
|
+
(get_attr (identifier) @name.reference.module)
|
|
60
|
+
) @reference.module
|
|
61
|
+
(#eq? @ref_type "module")
|
|
62
|
+
|
|
63
|
+
((variable_expr) @ref_type
|
|
64
|
+
(get_attr (identifier) @data_source_type)
|
|
65
|
+
(get_attr (identifier) @name.reference.data)
|
|
66
|
+
) @reference.data
|
|
67
|
+
(#eq? @ref_type "data")
|
|
68
|
+
|
|
69
|
+
((variable_expr) @resource_type
|
|
70
|
+
(get_attr (identifier) @name.reference.resource)
|
|
71
|
+
) @reference.resource
|
|
72
|
+
(#not-eq? @resource_type "var")
|
|
73
|
+
(#not-eq? @resource_type "local")
|
|
74
|
+
(#not-eq? @resource_type "module")
|
|
75
|
+
(#not-eq? @resource_type "data")
|
|
76
|
+
(#not-eq? @resource_type "provider")
|
|
77
|
+
(#not-eq? @resource_type "output")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(class_declaration
|
|
2
|
+
name: (identifier) @name.definition.class) @definition.class
|
|
3
|
+
|
|
4
|
+
(method_declaration
|
|
5
|
+
name: (identifier) @name.definition.method) @definition.method
|
|
6
|
+
|
|
7
|
+
(method_invocation
|
|
8
|
+
name: (identifier) @name.reference.call
|
|
9
|
+
arguments: (argument_list) @reference.call)
|
|
10
|
+
|
|
11
|
+
(interface_declaration
|
|
12
|
+
name: (identifier) @name.definition.interface) @definition.interface
|
|
13
|
+
|
|
14
|
+
(type_list
|
|
15
|
+
(type_identifier) @name.reference.implementation) @reference.implementation
|
|
16
|
+
|
|
17
|
+
(object_creation_expression
|
|
18
|
+
type: (type_identifier) @name.reference.class) @reference.class
|
|
19
|
+
|
|
20
|
+
(superclass (type_identifier) @name.reference.class) @reference.class
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
(
|
|
2
|
+
(comment)* @doc
|
|
3
|
+
.
|
|
4
|
+
(method_definition
|
|
5
|
+
name: (property_identifier) @name.definition.method) @definition.method
|
|
6
|
+
(#not-eq? @name.definition.method "constructor")
|
|
7
|
+
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
|
8
|
+
(#select-adjacent! @doc @definition.method)
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
(
|
|
12
|
+
(comment)* @doc
|
|
13
|
+
.
|
|
14
|
+
[
|
|
15
|
+
(class
|
|
16
|
+
name: (_) @name.definition.class)
|
|
17
|
+
(class_declaration
|
|
18
|
+
name: (_) @name.definition.class)
|
|
19
|
+
] @definition.class
|
|
20
|
+
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
|
21
|
+
(#select-adjacent! @doc @definition.class)
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
(
|
|
25
|
+
(comment)* @doc
|
|
26
|
+
.
|
|
27
|
+
[
|
|
28
|
+
(function
|
|
29
|
+
name: (identifier) @name.definition.function)
|
|
30
|
+
(function_declaration
|
|
31
|
+
name: (identifier) @name.definition.function)
|
|
32
|
+
(generator_function
|
|
33
|
+
name: (identifier) @name.definition.function)
|
|
34
|
+
(generator_function_declaration
|
|
35
|
+
name: (identifier) @name.definition.function)
|
|
36
|
+
] @definition.function
|
|
37
|
+
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
|
38
|
+
(#select-adjacent! @doc @definition.function)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
(
|
|
42
|
+
(comment)* @doc
|
|
43
|
+
.
|
|
44
|
+
(lexical_declaration
|
|
45
|
+
(variable_declarator
|
|
46
|
+
name: (identifier) @name.definition.function
|
|
47
|
+
value: [(arrow_function) (function)]) @definition.function)
|
|
48
|
+
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
|
49
|
+
(#select-adjacent! @doc @definition.function)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
(
|
|
53
|
+
(comment)* @doc
|
|
54
|
+
.
|
|
55
|
+
(variable_declaration
|
|
56
|
+
(variable_declarator
|
|
57
|
+
name: (identifier) @name.definition.function
|
|
58
|
+
value: [(arrow_function) (function)]) @definition.function)
|
|
59
|
+
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
|
60
|
+
(#select-adjacent! @doc @definition.function)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
(assignment_expression
|
|
64
|
+
left: [
|
|
65
|
+
(identifier) @name.definition.function
|
|
66
|
+
(member_expression
|
|
67
|
+
property: (property_identifier) @name.definition.function)
|
|
68
|
+
]
|
|
69
|
+
right: [(arrow_function) (function)]
|
|
70
|
+
) @definition.function
|
|
71
|
+
|
|
72
|
+
(pair
|
|
73
|
+
key: (property_identifier) @name.definition.function
|
|
74
|
+
value: [(arrow_function) (function)]) @definition.function
|
|
75
|
+
|
|
76
|
+
(
|
|
77
|
+
(call_expression
|
|
78
|
+
function: (identifier) @name.reference.call) @reference.call
|
|
79
|
+
(#not-match? @name.reference.call "^(require)$")
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
(call_expression
|
|
83
|
+
function: (member_expression
|
|
84
|
+
property: (property_identifier) @name.reference.call)
|
|
85
|
+
arguments: (_) @reference.call)
|
|
86
|
+
|
|
87
|
+
(new_expression
|
|
88
|
+
constructor: (_) @name.reference.class) @reference.class
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
; Definitions
|
|
2
|
+
|
|
3
|
+
(class_declaration
|
|
4
|
+
(type_identifier) @name.definition.class) @definition.class
|
|
5
|
+
|
|
6
|
+
(function_declaration
|
|
7
|
+
(simple_identifier) @name.definition.function) @definition.function
|
|
8
|
+
|
|
9
|
+
(object_declaration
|
|
10
|
+
(type_identifier) @name.definition.object) @definition.object
|
|
11
|
+
|
|
12
|
+
; References
|
|
13
|
+
|
|
14
|
+
(call_expression
|
|
15
|
+
[
|
|
16
|
+
(simple_identifier) @name.reference.call
|
|
17
|
+
(navigation_expression
|
|
18
|
+
(navigation_suffix
|
|
19
|
+
(simple_identifier) @name.reference.call))
|
|
20
|
+
]) @reference.call
|
|
21
|
+
|
|
22
|
+
(delegation_specifier
|
|
23
|
+
[
|
|
24
|
+
(user_type) @name.reference.type
|
|
25
|
+
(constructor_invocation
|
|
26
|
+
(user_type) @name.reference.type)
|
|
27
|
+
]) @reference.type
|