diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index c86c1a64e..4bb44ea1d 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -6,7 +6,7 @@ on: - develop permissions: - contents: write # Need write permission to commit changes + contents: write # Need write permission to commit changes jobs: generate-docs: @@ -22,10 +22,10 @@ jobs: uses: ./.github/actions/setup-environment - name: Generate API reference - run: uv run python src/gscli/cli.py generate docs + run: uv run python src/graph-sitter/gscli/cli.py generate docs - name: Generate System Prompt - run: uv run python src/gscli/cli.py generate system-prompt + run: uv run python src/graph-sitter/gscli/cli.py generate system-prompt - name: Commit changes run: | diff --git a/README.md b/README.md index 2e711f17b..86fad5318 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- The SWE that Never Sleeps + Scriptable interface to a powerful, multi-lingual language server.

@@ -15,55 +15,79 @@ [![PyPI](https://img.shields.io/badge/PyPi-codegen-gray?style=flat-square&color=blue)](https://pypi.org/project/codegen/) [![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) [![Slack Community](https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&style=flat-square)](https://community.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) +[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file) [![Follow on X](https://img.shields.io/twitter/follow/codegen?style=social)](https://x.com/codegen)

-The Codegen SDK provides a programmatic interface to code agents provided by [Codegen](https://codegen.com). +[Codegen](https://docs.codegen.com) is a python library for manipulating codebases. ```python -from codegen.agents.agent import Agent +from codegen import Codebase + +# Codegen builds a complete graph connecting +# functions, classes, imports and their relationships +codebase = Codebase("./") + +# Work with code without dealing with syntax trees or parsing +for function in codebase.functions: + # Comprehensive static analysis for references, dependencies, etc. + if not function.usages: + # Auto-handles references and imports to maintain correctness + function.move_to_file("deprecated.py") +``` + +Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale. -# Initialize the Agent with your organization ID and API token -agent = Agent( - org_id="YOUR_ORG_ID", # Find this at codegen.com/developer - token="YOUR_API_TOKEN", # Get this from codegen.com/developer - # base_url="https://codegen-sh-rest-api.modal.run", # Optional - defaults to production -) +## Installation and Usage -# Run an agent with a prompt -task = agent.run(prompt="Implement a new feature to sort users by last login.") +We support -# Check the initial status -print(task.status) +- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+) +- macOS and Linux + - macOS is supported + - Linux is supported on x86_64 and aarch64 with glibc 2.34+ + - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details. +- Python, Typescript, Javascript and React codebases -# Refresh the task to get updated status (tasks can take time) -task.refresh() +``` +# Install inside existing project +uv pip install codegen -# Check the updated status -print(task.status) +# Install global CLI +uv tool install codegen --python 3.13 -# Once task is complete, you can access the result -if task.status == "completed": - print(task.result) # Result often contains code, summaries, or links +# Create a codemod for a given repo +cd path/to/repo +gs init +gs create test-function + +# Run the codemod +gs run test-function + +# Create an isolated venv with codegen => open jupyter +gs notebook ``` -## Installation and Usage +## Usage -Install the SDK using pip or uv: +See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial. -```bash -pip install codegen -# or -uv pip install codegen ``` +from codegen import Codebase +``` + +## Troubleshooting + +Having issues? Here are some common problems and their solutions: -Get started at [codegen.com](https://codegen.com) and get your API token at [codegen.com/developer](https://codegen.com/developer). +- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`. +- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`. +- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`. -You can interact with your AI engineer via API, or chat with it in Slack, Linear, Github, or on our website. +If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out! ## Resources @@ -72,6 +96,18 @@ You can interact with your AI engineer via API, or chat with it in Slack, Linear - [Contributing](CONTRIBUTING.md) - [Contact Us](https://codegen.com/contact) +## Why Codegen? + +Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves. + +We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes: + +- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management. + +- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code. + +- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself. + ## Contributing Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. diff --git a/codegen-examples/README.md b/codegen-examples/README.md index ec2ae6cf8..d13002076 100644 --- a/codegen-examples/README.md +++ b/codegen-examples/README.md @@ -19,7 +19,7 @@ uv tool install codegen Initialize Codegen in your project ```bash -codegen init +gs init ``` Activate the virtual environment diff --git a/codegen-examples/examples/ai_impact_analysis/run.py b/codegen-examples/examples/ai_impact_analysis/run.py index dd8460214..7b786cff1 100644 --- a/codegen-examples/examples/ai_impact_analysis/run.py +++ b/codegen-examples/examples/ai_impact_analysis/run.py @@ -46,7 +46,7 @@ if not found_git: # Option C: Use from_repo method which handles cloning print("No local git repository found. Cloning a repository...") - codebase = Codebase.from_repo(repo_full_name="codegen-sh/codegen", language="python") + codebase = Codebase.from_repo(repo_full_name="codegen-sh/graph-sitter", language="python") print(f"Codebase loaded with {len(codebase.files)} files and {len(codebase.symbols)} symbols") diff --git a/codegen-examples/examples/codegen-mcp-server/README.md b/codegen-examples/examples/codegen-mcp-server/README.md index ad7d9da42..f56558d11 100644 --- a/codegen-examples/examples/codegen-mcp-server/README.md +++ b/codegen-examples/examples/codegen-mcp-server/README.md @@ -14,7 +14,7 @@
[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) +[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
@@ -36,7 +36,7 @@ This example demonstrates how to run a Model Control Protocol (MCP) server that 1. No installation is necessary, with the following command. Run this command directly or add it your `.json` mcp config file. ```bash - uvx --from 'git+https://github.com/codegen-sh/codegen-sdk.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server' codegen-mcp-server + uvx --from 'git+https://github.com/codegen-sh/graph-sitter.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server' codegen-mcp-server ``` ### Example MCP Config @@ -50,7 +50,7 @@ Here is an example mcp config that can be used with Cline or Claude desktop to i "command": "uvx", "args": [ "--from", - "git+https://github.com/codegen-sh/codegen-sdk.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server", + "git+https://github.com/codegen-sh/graph-sitter.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server", "codegen-mcp-server" ], "disabled": false, diff --git a/codegen-examples/examples/codegen-mcp-server/llms-install.md b/codegen-examples/examples/codegen-mcp-server/llms-install.md index 774d315ea..b01cdddcb 100644 --- a/codegen-examples/examples/codegen-mcp-server/llms-install.md +++ b/codegen-examples/examples/codegen-mcp-server/llms-install.md @@ -1,6 +1,6 @@ Please read two things before trying to install this codegen MCP server: -1. [Readme](https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/codegen-examples/examples/codegen-mcp-server/README.md) +1. [Readme](https://raw.githubusercontent.com/codegen-sh/graph-sitter/refs/heads/develop/codegen-examples/examples/codegen-mcp-server/README.md) - This contains the instructions for setting up the mcp server @@ -10,7 +10,7 @@ Please read two things before trying to install this codegen MCP server: Please use a CURL command to retrieve the contents of the readme and documentation and read both before starting to install the server. -1. curl -sL "https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/README.md" | cat +1. curl -sL "https://raw.githubusercontent.com/codegen-sh/graph-sitter/refs/heads/develop/README.md" | cat 1. curl -sL "https://docs.codegen.com/llms.txt" | cat diff --git a/codegen-examples/examples/linear_webhooks/uv.lock b/codegen-examples/examples/linear_webhooks/uv.lock index a57f080f5..a58dcf1f7 100644 --- a/codegen-examples/examples/linear_webhooks/uv.lock +++ b/codegen-examples/examples/linear_webhooks/uv.lock @@ -231,7 +231,7 @@ wheels = [ [[package]] name = "codegen" version = "0.22.2.dev14+g64374f8" -source = { git = "https://github.com/codegen-sh/codegen-sdk.git?rev=64374f8#64374f832539b137b83859dd88b3f78df3a5c664" } +source = { git = "https://github.com/codegen-sh/graph-sitter.git?rev=64374f8#64374f832539b137b83859dd88b3f78df3a5c664" } dependencies = [ { name = "anthropic" }, { name = "astor" }, @@ -999,7 +999,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "codegen", git = "https://github.com/codegen-sh/codegen-sdk.git?rev=64374f8" }, + { name = "codegen", git = "https://github.com/codegen-sh/graph-sitter.git?rev=64374f8" }, { name = "modal", specifier = ">=0.73.25" }, ] diff --git a/codegen-examples/examples/modal_repo_rag/README.md b/codegen-examples/examples/modal_repo_rag/README.md index 0ae5a3862..5209e7529 100644 --- a/codegen-examples/examples/modal_repo_rag/README.md +++ b/codegen-examples/examples/modal_repo_rag/README.md @@ -13,7 +13,7 @@
[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) +[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
diff --git a/codegen-examples/examples/promises_to_async_await/README.md b/codegen-examples/examples/promises_to_async_await/README.md index 7980a34f3..78c3a75ef 100644 --- a/codegen-examples/examples/promises_to_async_await/README.md +++ b/codegen-examples/examples/promises_to_async_await/README.md @@ -101,7 +101,7 @@ Currently, the `promise_chain.convert_to_async_await()` method handles the follo **IMPORTANT:** -_There will be cases that the current `promise_chain.convert_to_async_await()` cannot handle. In those cases, either right your own transformation logic using the codegen-sdk or open an issue on the [Codegen](https://github.com/codegen-sh/codegen-sdk) repository._ +_There will be cases that the current `promise_chain.convert_to_async_await()` cannot handle. In those cases, either right your own transformation logic using the codegen-sdk or open an issue on the [Codegen](https://github.com/codegen-sh/graph-sitter) repository._ ## Contributing diff --git a/codegen-examples/examples/repo_analytics/README.md b/codegen-examples/examples/repo_analytics/README.md index e072eb20e..55e7a83a4 100644 --- a/codegen-examples/examples/repo_analytics/README.md +++ b/codegen-examples/examples/repo_analytics/README.md @@ -107,7 +107,7 @@ The script will output a detailed report including: ``` šŸ“Š Repository Analysis Report šŸ“Š ================================================== -šŸ“ Repository: codegen-sh/codegen +šŸ“ Repository: codegen-sh/graph-sitter šŸ“ Description: [Repository description from GitHub] šŸ“ˆ Basic Metrics: diff --git a/codegen-examples/examples/repo_analytics/run.py b/codegen-examples/examples/repo_analytics/run.py index 79955e089..7d24fce0c 100644 --- a/codegen-examples/examples/repo_analytics/run.py +++ b/codegen-examples/examples/repo_analytics/run.py @@ -285,7 +285,7 @@ def analyze_repo(repo_url: str) -> Dict[str, Any]: if __name__ == "__main__": - repo_url = "codegen-sh/codegen" + repo_url = "codegen-sh/graph-sitter" results = analyze_repo(repo_url) print("\nšŸ“Š Repository Analysis Report šŸ“Š") diff --git a/codegen-examples/examples/slack_chatbot/README.md b/codegen-examples/examples/slack_chatbot/README.md index 6e115b450..e917abdfc 100644 --- a/codegen-examples/examples/slack_chatbot/README.md +++ b/codegen-examples/examples/slack_chatbot/README.md @@ -13,7 +13,7 @@
[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) +[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
diff --git a/codegen-examples/examples/slack_chatbot/api.py b/codegen-examples/examples/slack_chatbot/api.py index 681bb13ac..f24abb17d 100644 --- a/codegen-examples/examples/slack_chatbot/api.py +++ b/codegen-examples/examples/slack_chatbot/api.py @@ -20,7 +20,7 @@ def format_response(answer: str, context: list[tuple[str, int]]) -> str: """Format the response for Slack with file links.""" response = f"*Answer:*\n{answer}\n\n*Relevant Files:*\n" for filename, score in context: - github_link = f"https://github.com/codegen-sh/codegen-sdk/blob/develop/{filename}" + github_link = f"https://github.com/codegen-sh/graph-sitter/blob/develop/{filename}" response += f"• <{github_link}|{filename}>\n" return response @@ -28,7 +28,7 @@ def format_response(answer: str, context: list[tuple[str, int]]) -> str: def answer_question(query: str) -> tuple[str, list[tuple[str, int]]]: """Use RAG to answer a question about FastAPI.""" # Initialize codebase. Smart about caching. - codebase = Codebase.from_repo("codegen-sh/codegen-sdk", language="python", tmp_dir="/root") + codebase = Codebase.from_repo("codegen-sh/graph-sitter", language="python", tmp_dir="/root") # Initialize vector index index = VectorIndex(codebase) diff --git a/codegen-examples/examples/symbol-attributions/run.py b/codegen-examples/examples/symbol-attributions/run.py index 56e905ee4..34321ef91 100644 --- a/codegen-examples/examples/symbol-attributions/run.py +++ b/codegen-examples/examples/symbol-attributions/run.py @@ -70,7 +70,7 @@ def print_symbol_attribution(codebase): # Use from_repo method for a well-known repository print("Using a sample repository...") codebase = Codebase.from_repo( - repo_full_name="codegen-sh/codegen", + repo_full_name="codegen-sh/graph-sitter", # commit="", # Using a specific commit for consistency language="python", ) diff --git a/docs/_deprecated/graph-sitter/about.mdx b/docs/_deprecated/graph-sitter/about.mdx deleted file mode 100644 index d7ffe80a1..000000000 --- a/docs/_deprecated/graph-sitter/about.mdx +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "Codegen, Inc." -sidebarTitle: "About Us" -icon: "building" -iconType: "solid" ---- - - - -## Our Mission - -Our mission is to build fully-autonomous software engineering - the equivalent of self-driving cars for code. - -We believe the highest leverage path to autonomous development is enabling AI agents to "act via code." - -Just as self-driving cars need sophisticated sensors and controls to navigate the physical world, AI agents need powerful, precise tools to manipulate codebases. We're building that foundational layer: a programmatic interface that lets AI agents express complex code transformations through code itself. - -This approach creates a shared language that both humans and AI can use to: - -- Express powerful changes with precision and predictability -- Build sophisticated tools from primitive operations -- Create and maintain their own abstractions -- Scale transformations across massive codebases - -## The Team - -Based in San Francisco, we're a team of engineers and researchers passionate about: - -- Making large-scale code changes more accessible -- Building tools that work the way developers think -- Creating the infrastructure for AI-powered code manipulation -- Advancing the state of the art in program transformation - -## Open Source - -We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/codegen-sdk), is freely available and open to contributions from the community. - -## Join Us - - - - We're hiring! Join us in building the future of code transformation. - - - Connect with other developers and share your Codegen experiences. - - - -## Connect with Us - - - - Follow us for updates and announcements - - - Connect with our team and stay updated on company news - - - - - Want to learn more about what we're building? Check out our [getting started - guide](/introduction/getting-started) or join our [community - Slack](https://community.codegen.com). - diff --git a/docs/_deprecated/graph-sitter/advanced-settings.mdx b/docs/_deprecated/graph-sitter/advanced-settings.mdx deleted file mode 100644 index 0a6e86c91..000000000 --- a/docs/_deprecated/graph-sitter/advanced-settings.mdx +++ /dev/null @@ -1,404 +0,0 @@ ---- -title: "Advanced Settings" -sidebarTitle: "Advanced Settings" -icon: "memory" -iconType: "solid" ---- - -Codegen's [Codebase](/api-reference/core/Codebase) constructor accepts a `CodebaseConfig` object which is used to configure more advanced behaviors of the graph construction process. - -These flags are helpful for debugging problematic repos, optimizing Codegen's performance, or testing unreleased or experimental (potentially backwards-breaking) features. - - -**These are considered experimental features and may change in the future!** - -As such, they may have little to no testing or documentation. Many of these flags may also be unsupported in the future! - -If you need help, please visit our [community](/introduction/community). - - - -These configuration options are defined in [src/codegen/configs/models/codebase.py](https://github.com/codegen-sh/codegen/blob/develop/src/codegen/configs/models/codebase.py). - - -# Usage - -You can customize the behavior of the graph construction process when initializing a [Codebase](/api-reference/core/Codebase) by passing a `CodebaseConfig` object with the desired configuration flags. - -```python -from graph_sitter import Codebase -from codegen.configs import CodebaseConfig - -# Initialize a Codebase with custom configuration -codebase = Codebase( - "", - config=CodebaseConfig( - flag1=..., - flag2=..., - ... - ) -) -``` - -# Table of Contents - -- [debug](#flag-debug) -- [verify-graph](#flag-verify-graph) -- [track-graph](#flag-track-graph) -- [method-usages](#flag-method-usages) -- [sync-enabled](#flag-sync-enabled) -- [full-range-index](#flag-full-range-index) -- [ignore-process-errors](#flag-ignore-process-errors) -- [disable-graph](#flag-disable-graph) -- [disable-file-parse](#flag-disable-file-parse) -- [exp-lazy-graph](#flag-exp-lazy-graph) -- [generics](#flag-generics) -- [import-resolution-paths](#flag-import-resolution-paths) -- [import-resolution-overrides](#flag-import-resolution-overrides) -- [py-resolve-syspath](#flag-py-resolve-syspath) -- [ts-dependency-manager](#flag-ts-dependency-manager) -- [ts-language-engine](#flag-ts-language-engine) -- [v8-ts-engine](#flag-v8-ts-engine) -- [unpacking-assignment-partial-removal](#flag-unpacking-assignment-partial-removal) - -# Configuration Flags - -## Flag: `debug` -> **Default: `False`** - -Enables verbose logging for debugging purposes. In its current form, it enables: -- Verbose logging when adding nodes to the graph -- Verbose logging during initial file parsing -- Additional assertions on graph creation -- Additional (costly) debug metrics on codebase construction -- etc. - - -This flag may be very noisy and significantly impact performance. It is generally not recommended to use. - - -## Flag: `verify_graph` -> **Default: `False`** - -Adds assertions for graph state during reset resync. Used to test and debug graph desyncs after a codebase reset. - -Runs `post_reset_validation` after a reset resync. - - -This is an internal debug flag. - - -## Flag: `track_graph` -> **Default: `False`** - -Keeps a copy of the original graph before a resync. Used in conjunction with `verify_graph` to test and debug graph desyncs. - -Original graph is saved as `ctx.old_graph`. - - -This is an internal debug flag. - - -## Flag: `method_usages` -> **Default: `True`** - -Enables and disables resolving method usages. - -**Example Codebase:** -```python -class Foo: - def bar(): - ... - -obj = Foo() -obj.bar() # Method Usage -``` - -**Codemod with `method_usages` on:** -```python -bar_func = codebase.get_class("Foo").get_method("bar") -len(bar_func.usages) # 1 -bar_func.usages # [obj.bar()] -``` - -**Codemod with `method_usages` off:** -```python -bar_func = codebase.get_class("Foo").get_method("bar") -len(bar_func.usages) # 0 -bar_func.usages # [] -``` - -Method usage resolution could be disabled for a marginal performance boost. However, it is generally recommended to leave it enabled. - -## Flag: `sync_enabled` -> **Default: `False`** - -Enables or disables graph sync during `codebase.commit`. - - -Implementation-specific details on sync graph can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/6.%20incremental-computation/C.%20Graph%20Recomputation.md). - - -This section won't go into the specific details of sync graph, but the general idea is that enabling sync graph will update the Codebase object to whatever new changes were made. - -**Example with `sync_enabled` on:** -```python -file = codebase.get_file(...) -file.insert_after("foobar = 1") -codebase.commit() - -foobar = codebase.get_symbol("foobar") -assert foobar # foobar is available after commit / graph sync -``` - -**Example with `sync_enabled` disabled:** -```python -file = codebase.get_file(...) -file.insert_after("foobar = 1") - -foobar = codebase.get_symbol("foobar", optional=True) -assert not foobar # foobar is not available after commit -``` - - -Enabling sync graph will have a performance impact on codebase commit, but will also unlock a bunch of operations that were previously not possible. - - -## Flag: `full_range_index` -> **Default: `False`** - -By default, Codebase maintains an internal range-to-node index for fast lookups. (i.e. `bytes 120 to 130 maps to node X`). -For optimization purposes, this only applies to nodes defined and handled by `parser.py`. - -Enabling `full_range_index` will create an additional index that maps **all** tree-sitter ranges to nodes. -This can be useful for debugging or when you need to build any applications that require a full range-to-node index (i.e. a codebase tree lookup). - - -This flag **significantly** increases memory usage! - - -## Flag: `ignore_process_errors` -> **Default: `True`** - -Controls whether to ignore errors that occur during external process execution (such as dependency manager or language engine). - -Disabling `ignore_process_errors` would make Codegen fail on errors that would otherwise be logged then ignored. - -## Flag: `disable_graph` -> **Default: `False`** - -Disables the graph construction process. Any operations that require the graph will no longer work. (In other words, this turns off import resolution and usage/dependency resolution) - -Functions that operate purely on AST such as getting and editing parameters or modifying function and class definitions will still work. - - -For codemods that do not require the graph (aka only AST/Syntax-level changes), **disabling graph parse could yield a 30%-40% decrease in parse time and memory usage**! - - -## Flag: `disable_file_parse` -> **Default: `False`** - -Disables **ALL** parsing, including file and graph parsing. This essentially treats all codebases as the "UNSUPPORTED" language mode. - -Nearly all functions except for editing primitives like `codebase.get_file` and `file.edit` will no longer work. - - -This flag is useful for any usages of Codegen that do **NOT** require any AST/CST/Graph parsing. (i.e. using Codegen purely as a file editing harness) - -If this is your use case, this **could decrease parse and memory usage by 95%.** - - -## Flag: `exp_lazy_graph` -> **Default: `False`** - -This experimental flag pushes the graph creation back until the graph is needed. This is an experimental feature and may have some unintended consequences. - -**Example Codemod:** -```python -from graph_sitter import Codebase -from codegen.configs import CodebaseConfig - -# Enable lazy graph parsing -codebase = Codebase("", config=CodebaseConfig(exp_lazy_graph=True)) - -# The codebase object will be created immediately with no parsing done -# These all do not require graph parsing -codebase.files -codebase.directories -codebase.get_file("...") - -# These do require graph parsing, and will create the graph only if called -codebase.get_function("...") -codebase.get_class("...") -codebase.imports -``` - - -This may have a very slight performance boost. Use at your own risk! - - -## Flag: `generics` -> **Default: `True`** - -Enables and disables generic type resolution. - -**Example Codebase:** -```python -class Point: - def scale(cls, n: int): - pass - -class List[T](): - def pop(self) -> T: - ... - -l: List[Point] = [] -l.pop().scale(1) # Generic Usage -``` - -**Codemod with `generics` on:** -```python -bar_func = codebase.get_class("Point").get_method("scale") -len(bar_func.usages) # 1 -bar_func.usages # [l.pop().scale(1)] -``` - -**Codemod with `generics` off:** -```python -bar_func = codebase.get_class("Point").get_method("scale") -len(bar_func.usages) # 0 -bar_func.usages # [] -``` - - -Generic resolution is still largely WIP and experimental, and may not work in all cases. In some rare circumstances, disabling generics may result in a significant performance boost. - - -## Flag: `import_resolution_paths` -> **Default: `[]`** - -Controls alternative paths to resolve imports from. - -**Example Codebase:** -```python -# a/b/c/src.py -def update(): - pass - -# consumer.py -from c import src as operations - -operations.update() -``` - -**Codemod:** -```python -codebase.ctx.config.import_resolution_paths = ["a/b"] -``` - -## Flag: `import_resolution_overrides` -> **Default: `{}`** - -Controls import path overrides during import resolution. - -**Example** -`from a.b.c import d` with the override `a/b` -> `foo/bar` will internally resolve the import as `from foo.bar.c import d`. - -## Flag: `py_resolve_syspath` -> **Default: `False`** - -Enables and disables resolution of imports from `sys.path`. - - -For this to properly work, you must also set `allow_external` to `True`. - - -## Flag: `allow_external` -> **Default: `False`** - -Enables resolving imports, files, modules, and directories from outside of the repo path. - - -Turning this flag off may allow for bad actors to access files outside of the repo path! Use with caution! - - -## Flag: `ts_dependency_manager` -> **Default: `False`** - - -**This is an internal flag used for Codegen Cloud and should not be used externally!** - -This flag **WILL** nuke any existing `node_modules` folder! - - - -This flag also assumes many constants for Codegen Cloud. Very likely this will not work if run locally. - -Instead, just install `node_modules` as normal (either through `npm`, `pnpm`, or `yarn`) and skip this setting! - - -Enables Codegen's internal dependency installer for TypeScript. This will modify `package.json` and install the bare minimum set of installable dependencies. - - -More documentation on TypeScript dependency manager can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/external/dependency-manager.md) - - -## Flag: `ts_language_engine` -> **Default: `False`** - - -This feature was built primarily with Codegen Cloud in mind. As such, this assumes a valid NodeJS and TypeScript environment. - - -Enables using the TypeScript compiler to extract information from the codebase. Enables commands such as `inferred_return_type`. - - -This will increase memory usage and parsing time. Larger repos may even hit resource constraints with the bundled TypeScript compiler integration. - - -## Flag: `v8_ts_engine` -> **Default: `False`** - - -This feature flag requires `ts_language_engine` to be enabled as well. - - -Enables using the **V8-based TypeScript compiler** to extract information from the codebase. Enables commands such as `inferred_return_type`. - -The V8 implementation (as opposed to the default external-process based implementation) is less stable, but provides the entire TypeScript API to be used from within Codegen. - - -This will increase memory usage and parsing time. Larger repos may even hit resource constraints with the V8-based TypeScript compiler integration. - - -## Flag: `unpacking_assignment_partial_removal` -> **Default: `False`** - -Enables smarter removal of unpacking assignments. - -**Example Codebase:** -```python -a, b, c = (1, 2, 3) -``` - -**Codemod with `unpacking_assignment_partial_removal` on:** -```python -file = codebase.get_file(...) -b = file.get_symbol("b") -b.remove() -codebase.commit() - -file.symbols # [a, c] -file.source # "a, c = (1, 3)" -``` - -**Codemod with `unpacking_assignment_partial_removal` off:** -```python -file = codebase.get_file(...) -b = file.get_symbol("b") -b.remove() -codebase.commit() - -file.symbols # [] -file.source # "" -``` diff --git a/docs/_deprecated/graph-sitter/community.mdx b/docs/_deprecated/graph-sitter/community.mdx deleted file mode 100644 index ed02a4276..000000000 --- a/docs/_deprecated/graph-sitter/community.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Community & Contributing" -sidebarTitle: "Community" -icon: "people-group" -iconType: "solid" ---- - -import { - COMMUNITY_SLACK_URL, - CODEGEN_SDK_GITHUB_URL, -} from "/snippets/links.mdx"; - -Join the growing Codegen community! We're excited to have you be part of our journey to make codebase manipulation and transformation more accessible. - - - - Connect with the community, get help, and share your Codegen projects in our - active Slack workspace. - - - Star us on GitHub, report issues, submit PRs, and contribute to the project. - - - Follow us for updates, tips, and community highlights. - - - Learn how to use Codegen effectively with our comprehensive guides. - - - - - Please help us improve this library and documentation by submitting a PR! - - -## Contributing - -We welcome contributions of all kinds! Whether you're fixing a typo in documentation, reporting a bug, or implementing a new feature, we appreciate your help in making Codegen better. - -Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/develop/CONTRIBUTING.md) on GitHub to learn how to: - -- Set up your development environment -- Submit pull requests -- Report issues -- Contribute to documentation diff --git a/docs/_deprecated/graph-sitter/faq.mdx b/docs/_deprecated/graph-sitter/faq.mdx deleted file mode 100644 index d7f3abfba..000000000 --- a/docs/_deprecated/graph-sitter/faq.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: "Frequently Asked Questions" -sidebarTitle: "FAQ" -icon: "square-question" -iconType: "solid" ---- - - - - Codegen currently parses two languages: - - [Python](/api-reference/python) - - [TypeScript](/api-reference/typescript) - - We're actively working on expanding language support based on community needs. - - Learn more about how Codegen handles language specifics in the [Language - Support](/building-with-codegen/language-support) guide. - - - Interested in adding support for your language? [Let us know](https://x.com/codegen) or [contribute](/introduction/community)! - - - - - Pretty much! Codegen is roughly on par with `mypy` and `tsc`. There are always edge cases in static analysis that are provably impossible to get (for example doing `eval()` on a string), but all of Codegen's APIs are intended to be exact unless otherwise specified. Please reach out if you find an edge case and we will do our best to patch it. - - - Yes! Codegen was developed on multmillion-line Python and Typescript codebases - and includes optimizations for handling large-scale transformations. - - For enterprise support, please reach out to [team@codegen.com](mailto:team@codegen.com) - - - - Yes - [by design](/introduction/guiding-principles#python-first-composability). - - Codegen works like any other python package. It works alongside your IDE, version control system, and other development tools. - - - Start by trying out Codegen, joining our [Slack community](https://community.codegen.com), and looking for - issues labeled "good first issue" on [GitHub](https://github.com/codegen-sh/codegen-sdk). We welcome contributions to - documentation, examples, and code improvements. - - - Yes, Codegen is [open source](https://github.com/codegen-sh/codegen-sdk) and free to use under the [Apache 2.0 - license](https://github.com/codegen-sh/codegen-sdk?tab=Apache-2.0-1-ov-file). - You can use it for both personal and commercial projects. - - - The best places to get help are: - 1. Our community [Slack channel](https://community.codegen.com) - 2. [GitHub issues](https://github.com/codegen-sh/codegen-sdk) for bug reports - 3. Reach out to us on [Twitter](https://x.com/codegen) - - diff --git a/docs/_deprecated/graph-sitter/guiding-principles.mdx b/docs/_deprecated/graph-sitter/guiding-principles.mdx deleted file mode 100644 index 53201e5c1..000000000 --- a/docs/_deprecated/graph-sitter/guiding-principles.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "Guiding Principles" -sidebarTitle: "Principles" -icon: "compass" -iconType: "solid" ---- - -Codegen was developed by working backwards from real-world, large-scale codebase migrations. Instead of starting with abstract syntax trees and parser theory, we started with the question: "How do developers actually think about code changes?" - -This practical origin led to four core principles that shape Codegen's design: - -## Intuitive APIs - -Write code that reads like natural language, without worrying about abstract syntax trees or parser internals. Codegen provides high-level APIs that map directly to the transformations developers want to perform: - -```python -# Methods that read like English -function.rename("new_name") # Not ast.update_node(function_node, "name", "new_name") -function.move_to_file("new_file.py") # Not ast.relocate_node(function_node, "new_file.py") - -# Clean, readable properties -if function.is_async: # Not ast.get_node_attribute(function_node, "async") - print(function.name) # Not ast.get_node_name(function_node) - -# Natural iteration patterns -for usage in function.usages: # Not ast.find_references(function_node) - print(f"Used in {usage.file.name}") -``` - -## No Sharp Edges - -Focus on your high-level intent while Codegen handles the intricate details. - -Codegen operations handle the edge cases - it should be hard to break lint. - -```python -# Moving a function? Codegen handles: -function.move_to_file("new_file.py") -# āœ“ Updating all import statements -# āœ“ Preserving dependencies -# āœ“ Maintaining references -# āœ“ Fixing relative imports -# āœ“ Resolving naming conflicts - -# Renaming a symbol? Codegen manages: -class_def.rename("NewName") -# āœ“ Updating all usages -# āœ“ Handling string references -# āœ“ Preserving docstrings -# āœ“ Maintaining inheritance -``` - -## Performance through Pre-Computation - -Codegen frontloads as much as possible to enable fast, efficient transformations. - -It is built with the insight that each codebase only needs to be parsed once per commit. - - - Learn more about parsing the codebase graph in the [How it - Works](/introduction/how-it-works) guide. - - -## Python-First Composability - -Codegen embraces Python's strength as a "glue language" - its ability to seamlessly integrate different tools and APIs. This makes it natural to compose Codegen with your existing toolchain: - -- Build complex transforms by combining simpler operations -- Integrate Codegen with your existing tools (linters, type checkers, test frameworks, AI tools) - - - Python's rich ecosystem makes it ideal for code manipulation tasks. Codegen is - designed to be one tool in your toolbox, not a replacement for your entire - workflow. - diff --git a/docs/_deprecated/graph-sitter/how-it-works.mdx b/docs/_deprecated/graph-sitter/how-it-works.mdx deleted file mode 100644 index d891a9c08..000000000 --- a/docs/_deprecated/graph-sitter/how-it-works.mdx +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: "Under the Hood" -sidebarTitle: "How it Works" -icon: "gear" -iconType: "solid" -subtitle: "How Codegen's codebase graph works" ---- - -Codegen performs advanced static analysis to build a rich graph representation of your codebase. This pre-computation step analyzes dependencies, references, types, and control flow to enable fast and reliable code manipulation operations. - - - Codegen is built on top of - [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) and - [rustworkx](https://github.com/Qiskit/rustworkx) and has implemented most - language server features from scratch. - - - Codegen is open source. Check out the [source - code](https://github.com/codegen-sh/codegen-sdk) to learn more! - - -## The Codebase Graph - -At the heart of Codegen is a comprehensive graph representation of your code. When you initialize a [Codebase](/api-reference/core/Codebase), it performs static analysis to construct a rich graph structure connecting code elements: - -```python -# Initialize and analyze the codebase -from graph_sitter import Codebase -codebase = Codebase("./") - -# Access pre-computed relationships -function = codebase.get_symbol("process_data") -print(f"Dependencies: {function.dependencies}") # Instant lookup -print(f"Usages: {function.usages}") # No parsing needed -``` - -### Building the Graph - -Codegen's graph construction happens in two stages: - -1. **AST Parsing**: We use [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) as our foundation for parsing code into Abstract Syntax Trees. Tree-sitter provides fast, reliable parsing across multiple languages. - -2. **Multi-file Graph Construction**: Custom parsing logic, implemented in [rustworkx](https://github.com/Qiskit/rustworkx) and Python, analyzes these ASTs to construct a more sophisticated graph structure. This graph captures relationships between [symbols](/building-with-codegen/symbol-api), [files](/building-with-codegen/files-and-directories), [imports](/building-with-codegen/imports), and more. - -### Performance Through Pre-computation - -Pre-computing a rich index enables Codegen to make certain operations very fast that that are relevant to refactors and code analysis: - -- Finding all usages of a symbol -- Detecting circular dependencies -- Analyzing the dependency graphs -- Tracing call graphs -- Static analysis-based code retrieval for RAG -- ...etc. - - - Pre-parsing the codebase enables constant-time lookups rather than requiring - re-parsing or real-time analysis. - - -## Multi-Language Support - -One of Codegen's core principles is that many programming tasks are fundamentally similar across languages. - -Currently, Codegen supports: - -- [Python](/api-reference/python) -- [TypeScript](/api-reference/typescript) -- [React & JSX](/building-with-codegen/react-and-jsx) - - - Learn about how Codegen handles language specifics in the [Language - Support](/building-with-codegen/language-support) guide. - - -We've started with these ecosystems but designed our architecture to be extensible. The graph-based approach provides a consistent interface across languages while handling language-specific details under the hood. - -## Build with Us - -Codegen is just getting started, and we're excited about the possibilities ahead. We enthusiastically welcome contributions from the community, whether it's: - -- Adding support for new languages -- Implementing new analysis capabilities -- Improving performance -- Expanding the API -- Adding new transformations -- Improving documentation - -Check out our [community guide](/introduction/community) to get involved! diff --git a/docs/_deprecated/graph-sitter/ide-usage.mdx b/docs/_deprecated/graph-sitter/ide-usage.mdx deleted file mode 100644 index b1356c21f..000000000 --- a/docs/_deprecated/graph-sitter/ide-usage.mdx +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: "Using Codegen in Your IDE" -sidebarTitle: "IDE Usage" -icon: "window" -iconType: "solid" ---- - -Get up and running with Codegen programs in IDEs like VSCode, Cursor and PyCharm. - -Make sure to [install and initialize](/introduction/installation) Codegen with `codegen init` - -## Configuring your IDE Interpreter - -Codegen creates a custom Python environment in `.codegen/.venv`. Configure your IDE to use this environment for the best development experience. - - - - 1. Install the VSCode Python Extensions for LSP and debugging support. We recommend Python, Pylance and Python Debugger for the best experience. - - 2. Open the Command Palette (Cmd/Ctrl + Shift + P) - 3. Type "Python: Select Interpreter" - - 4. Choose "Enter interpreter path" - 5. Navigate to and select: - ```bash - .codegen/.venv/bin/python - ``` - - Alternatively, create a `.vscode/settings.json`: - ```json - { - "python.defaultInterpreterPath": "${workspaceFolder}/.codegen/.venv/bin/python", - "python.analysis.extraPaths": [ - "${workspaceFolder}/.codegen/.venv/lib/python3.12/site-packages" - ] - } - ``` - - - - 1. Open PyCharm Settings/Preferences - 2. Navigate to "Project > Python Interpreter" - 3. Click the gear icon āš™ļø and select "Add" - 4. Choose "Existing Environment" - 5. Set interpreter path to: - ```bash - .codegen/.venv/bin/python - ``` - - - - - -## MCP Server Setup -This is an optional step but highly recommended if your IDE supports MCP support and you use AI Agents. -The MCP server is a local server that allows your AI Agent to interact with the Codegen specific tools, -it will allow an agent to: -- ask an expert to create a codemod -- improve a codemod -- get setup instructions - -### IDE Configuration -#### Cline -Add this to your cline_mcp_settings.json: -```json -{ - "mcpServers": { - "graph_sitter.cli": { - "command": "uv", - "args": [ - "--directory", - "/codegen-sdk/src/graph_sitter.cli/mcp", - "run", - "server.py" - ] - } - } -} -``` - - -#### Cursor: -Under the `Settings` > `Feature` > `MCP Servers` section, click "Add New MCP Server" and add the following: - -``` -Name: codegen-mcp -Type: Command -Command: uv --directory /codegen-sdk/src/graph_sitter.cli/mcp run server.py -``` - - -## Index Codegen Docs -#### Cursor: -If you use Cursor you'll be able to configure the IDE to index the Codegen docs. To do so go to `Settings` > `Features` > `Docs` -and then click on `Add new docs`. We recommend using this url to index the API reference: -``` -https://docs.codegen.com/api-reference/index -``` - - -## Create a New Codemod - -Generate the boilerplate for a new code manipulation program using [codegen create](/cli/create): - -```bash -codegen create organize-types \ - -d "Move all TypeScript types to \ - into a centralized types.ts file" -``` - - - Passing in `-d --description` will get an LLM expert to compose an initial version for you. This requires a Github account registered on [codegen.sh](https://codegen.sh) - - -This will: -1. Create a new codemod in `.codegen/codemods/organize_types/` -2. Generate a custom `system-prompt.txt` based on your task -3. Set up the basic structure for your program - - -The generated codemod includes type hints and docstrings, making it easy to get IDE autocompletion and documentation. - - -## Iterating with Chat Assistants - -When you do `codegen init`, you will receive a [system prompt optimized for AI consumption](/introduction/work-with-ai) at `.codegen/codegen-system-prompt.txt`. - -If you reference this file in "chat" sessions with Copilot, Cursor, Cody, etc., the assistant will become fluent in Codegen. - - - - Collaborating with Cursor's assistant and the Codegen system prompt - - -In addition, when you [create](/cli/create) a codemod with "-d", Codegen generates an optimized system prompt in `.codegen/codemods/{name}/{name}-system-prompt.txt`. This prompt contains: -- Relevant Codegen API documentation -- Examples of relevant transformations -- Context about your specific task - - -You can also drag and drop the system prompt ([available here](/introduction/work-with-ai))file directly into chat windows like ChatGPT or Claude for standalone help. - - -## Running and Testing Codemods - -```bash -# Run => write changes to disk -codegen run organize-types - -# Reset changes on disk -codegen reset -``` - -You can also run the program directly via `.codegen/.venv/bin/python path/to/codemod.py` or via your editor's debugger - -## Viewing Changes - -We recommend viewing changes in your IDE's native diff editor. - - -## What's Next - - - - See real-world examples of codemods in action. - - - Learn about Codegen's core concepts and features - - diff --git a/docs/_deprecated/graph-sitter/overview.mdx b/docs/_deprecated/graph-sitter/overview.mdx deleted file mode 100644 index 4a0011d6c..000000000 --- a/docs/_deprecated/graph-sitter/overview.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: "Codegen" -sidebarTitle: "Overview" -icon: "code" -iconType: "solid" ---- - -[Codegen](https://github.com/codegen-sh/codegen-sdk) is a python library for manipulating codebases. - -It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/). - -```python -from graph_sitter import Codebase - -# Codegen builds a complete graph connecting -# functions, classes, imports and their relationships -codebase = Codebase("./") - -# Work with code without dealing with syntax trees or parsing -for function in codebase.functions: - # Comprehensive static analysis for references, dependencies, etc. - if not function.usages: - # Auto-handles references and imports to maintain correctness - function.remove() - -# Fast, in-memory code index -codebase.commit() -``` - - - -Codegen handles complex refactors while maintaining correctness, enabling a broad set of advanced code manipulation programs. - - -Codegen works with both Python and Typescript/JSX codebases. Learn more about language support [here](/building-with-codegen/language-support). - -## Quick Started - - -Codegen requires Python 3.12 - 3.13 (recommended: Python 3.13+). - - -### Using UV (Recommended) -```bash -uv tool install codegen --python 3.13 -``` - -### Using Pipx - - -Pipx is not officially supported by Codegen, but it should still work. - - -```bash -pipx install codegen -``` - - -For further & more in depth installation instructions, see the [installation guide](/introduction/installation). - - -## What can I do with Codegen? - -Codegen's simple yet powerful APIs enable a range of applications, including: - - - - Create an intelligent agent that can analyze and manipulate your codebase using natural language. - - - Generate interactive visualizations of your codebase's structure, dependencies, and relationships. - - - Create high-quality training data for fine-tuning LLMs on your codebase. - - - Create powerful code transformations to automate large-scale changes. - - - -See below for an example call graph visualization generated with Codegen. - - - - - -View source code on [modal/modal-client](https://github.com/modal-labs/modal-client/blob/cbac0d80dfd98588027ecd21850152776be3ab82/modal/client.py#L70). View codemod on [codegen.sh](https://www.codegen.sh/codemod/66e2e195-ceec-4935-876a-ed4cfc1731c7/public/diff) - - -## Get Started - -import { - COMMUNITY_SLACK_URL, - CODEGEN_SDK_GITHUB_URL, -} from "/snippets/links.mdx"; - - - - Follow our step-by-step tutorial to start manipulating code with Codegen. - - - Learn how to use Codegen for common code transformation tasks. - - - Star us on GitHub and contribute to the project. - - - Get help and connect with the Codegen community. - - - -## Why Codegen? - -Many software engineering tasks - refactors, enforcing patterns, analyzing control flow, etc. - are fundamentally programmatic operations. Yet the tools we use to express these transformations often feel disconnected from how we think about code. - -Codegen was engineered backwards from real-world refactors we performed for enterprises at [Codegen, Inc.](/introduction/about). Instead of starting with theoretical abstractions, we built the set of APIs that map directly to how humans and AI think about code changes: - -- **Natural Mental Model**: Express transformations through high-level operations that match how you reason about code changes, not low-level text or AST manipulation. -- **Clean Business Logic**: Let the engine handle the complexities of imports, references, and cross-file dependencies. -- **Scale with Confidence**: Make sweeping changes across large codebases consistently across Python, TypeScript, JavaScript, and React. - -As AI becomes increasingly sophisticated, we're seeing a fascinating shift: AI agents aren't bottlenecked by their ability to understand code or generate solutions. Instead, they're limited by their ability to efficiently manipulate codebases. The challenge isn't the "brain" - it's the "hands." - -We built Codegen with a key insight: future AI agents will need to ["act via code,"](/blog/act-via-code) building their own sophisticated tools for code manipulation. Rather than generating diffs or making direct text changes, these agents will: - -1. Express transformations as composable programs -2. Build higher-level tools by combining primitive operations -3. Create and maintain their own abstractions for common patterns - -This creates a shared language that both humans and AI can reason about effectively, making code changes more predictable, reviewable, and maintainable. Whether you're a developer writing a complex refactoring script or an AI agent building transformation tools, Codegen provides the foundation for expressing code changes as they should be: through code itself. diff --git a/docs/_deprecated/tutorials/slack-bot.mdx b/docs/_deprecated/tutorials/slack-bot.mdx deleted file mode 100644 index 9a7b0030e..000000000 --- a/docs/_deprecated/tutorials/slack-bot.mdx +++ /dev/null @@ -1,217 +0,0 @@ ---- -title: "Building a RAG-powered Slack Bot" -sidebarTitle: "Slack Bot" -icon: "slack" -iconType: "solid" ---- - -This tutorial demonstrates how to build a Slack bot that can answer code questions using simple RAG (Retrieval Augmented Generation) over a codebase. The bot uses semantic search to find relevant code snippets and generates detailed answers using OpenAI's APIs. - -View the full code and setup instructions in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/slack_chatbot) - -While this example uses the Codegen codebase, you can adapt it to any repository by changing the repository URL - -## Overview - -The process involves three main steps: - -1. Initializing and indexing the codebase -2. Finding relevant code snippets for a query -3. Generating answers using RAG - -Let's walk through each step using Codegen. - -## Step 1: Initializing the Codebase - -First, we initialize the codebase and create a vector index for semantic search: - -```python -from graph_sitter import Codebase -from graph_sitter.extensions import VectorIndex - -def initialize_codebase(): - """Initialize and index the codebase.""" - # Initialize codebase with smart caching - codebase = Codebase.from_repo( - "codegen-sh/codegen-sdk", - language="python", - tmp_dir="/root" - ) - - # Initialize vector index - index = VectorIndex(codebase) - - # Try to load existing index or create new one - index_path = "/root/E.pkl" - try: - index.load(index_path) - except FileNotFoundError: - # Create new index if none exists - index.create() - index.save(index_path) - - return codebase, index -``` - - -The vector index is persisted to disk, so subsequent queries will be much faster. -See [semantic code search](/building-with-codegen/semantic-code-search) to learn more about VectorIndex. - - -## Step 2: Finding Relevant Code - -Next, we use the vector index to find code snippets relevant to a query: - -```python -def find_relevant_code(index: VectorIndex, query: str) -> list[tuple[str, float]]: - """Find code snippets relevant to the query.""" - # Get top 10 most relevant files - results = index.similarity_search(query, k=10) - - # Clean up chunk references from index - cleaned_results = [] - for filepath, score in results: - if "#chunk" in filepath: - filepath = filepath.split("#chunk")[0] - cleaned_results.append((filepath, score)) - - return cleaned_results -``` - - -VectorIndex automatically chunks large files for better search results. We clean up the chunk references to show clean file paths. - - -## Step 3: Generating Answers - -Finally, we use GPT-4 to generate answers based on the relevant code: - -```python -from openai import OpenAI - -def generate_answer(query: str, context: str) -> str: - """Generate an answer using RAG.""" - prompt = f"""You are a code expert. Given the following code context and question, -provide a clear and accurate answer. - -Note: Keep it short and sweet - 2 paragraphs max. - -Question: {query} - -Relevant code: -{context} - -Answer:""" - - client = OpenAI() - response = client.chat.completions.create( - model="gpt-4o", - messages=[ - {"role": "system", "content": "You are a code expert. Answer questions about the given repo based on RAG'd results."}, - {"role": "user", "content": prompt}, - ], - temperature=0, - ) - - return response.choices[0].message.content -``` - -## Putting It All Together - -Here's how the components work together to answer questions: - -```python -def answer_question(query: str) -> tuple[str, list[tuple[str, float]]]: - """Answer a question about the codebase using RAG.""" - # Initialize or load codebase and index - codebase, index = initialize_codebase() - - # Find relevant files - results = find_relevant_code(index, query) - - # Collect context from relevant files - context = "" - for filepath, score in results: - file = codebase.get_file(filepath) - context += f"File: {filepath}\n```\n{file.content}\n```\n\n" - - # Generate answer - answer = generate_answer(query, context) - - return answer, results -``` - -This will: -1. Load or create the vector index -2. Find relevant code snippets -3. Generate a detailed answer -4. Return both the answer and file references - -## Example Usage - -Here's what the output looks like: - -```python -answer, files = answer_question("How does VectorIndex handle large files?") - -print("Answer:", answer) -print("\nRelevant files:") -for filepath, score in files: - print(f"• {filepath} (score: {score:.2f})") -``` - -Output: -``` -Answer: -VectorIndex handles large files by automatically chunking them into smaller pieces -using tiktoken. Each chunk is embedded separately and can be searched independently, -allowing for more precise semantic search results. - -Relevant files: -• src/graph_sitter.extensions/vector_index.py (score: 0.92) -• src/graph_sitter.extensions/tools/semantic_search.py (score: 0.85) -``` - -## Extensions - -While this example demonstrates a simple RAG-based bot, you can extend it to build a more powerful code agent that can: -- Do more sophisticated code retrieval -- Make code changes using Codegen's edit APIs -- Gather further context from Slack channels -- ... etc. - -Check out our [Code Agent tutorial](/tutorials/build-code-agent) to learn how to build an intelligent agent with access to Codegen's full suite of tools - - -## Learn More - - - - Learn how to use VectorIndex for semantic code search and embeddings. - - - Create a more powerful agent with multi-step reasoning and code manipulation. - - - Learn about OpenAI's text embeddings and how they work. - - - Understand RAG patterns and best practices for better results. - - diff --git a/docs/_deprecated/api-reference/core/Argument.mdx b/docs/api-reference/core/Argument.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Argument.mdx rename to docs/api-reference/core/Argument.mdx index 81e631e90..83aab527d 100644 --- a/docs/_deprecated/api-reference/core/Argument.mdx +++ b/docs/api-reference/core/Argument.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_keyword Converts an unnamed argument to a named argument by adding a keyword. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -120,7 +120,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Argument ] } description=""/> @@ -209,7 +209,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -217,7 +217,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -330,7 +330,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -338,7 +338,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -346,7 +346,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -354,7 +354,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -362,7 +362,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -157,7 +157,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Assignment ] } description=""/> @@ -269,7 +269,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -277,7 +277,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -396,7 +396,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -404,7 +404,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -412,7 +412,7 @@ Retrieves all usages of the assigned variable within its code block scope. ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -449,7 +449,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -457,7 +457,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ AssignmentStatement ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -309,7 +309,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -333,7 +333,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -341,7 +341,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Attribute ] } description=""/> @@ -239,7 +239,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -247,7 +247,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -360,7 +360,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -368,7 +368,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -376,7 +376,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -384,7 +384,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -392,7 +392,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ AwaitExpression ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -395,7 +395,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ BinaryExpression ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a binary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -130,7 +130,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ BlockStatement ] } description=""/> @@ -219,7 +219,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -332,7 +332,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -340,7 +340,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -348,7 +348,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -364,7 +364,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Boolean ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Callable ] } description=""/> @@ -211,7 +211,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -219,7 +219,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -383,7 +383,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -391,7 +391,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -399,7 +399,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -407,7 +407,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -415,7 +415,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [BlockStatement](/api-reference/core/BlockStatement), [Statement](/api-reference/core/Statement), [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ CatchStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ChainedAttribute ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Symbol](/api-reference/core/Symbol), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -147,7 +147,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds an attribute to a class from raw source code, placing it in a specific location - + add_comment Adds a comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_source Add a block of source code to the bottom of a class definition. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -269,7 +269,7 @@ Find all ancestors of the node of the given type. Does not return itself ### attributes Retrieves all attributes from this Class including those from its superclasses up to a - + dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Class ] } description=""/> @@ -404,7 +404,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -446,7 +446,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -650,7 +650,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_subclass_of Checks if the class inherits from a specified parent class. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -681,7 +681,7 @@ Check if this node is contained another node of the given class ### methods Retrieves all methods that exist on this Class, including methods from superclasses, with - + move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -747,7 +747,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -755,7 +755,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -763,7 +763,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -123,7 +123,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ CodeBlock ] } description=""/> @@ -212,7 +212,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_assignments Returns a list of assignments with the specified variable name. - + get_attributes Returns attributes from the code block, with the option to include or exclude private - + get_comment Gets the first comment statement containing a specific text string. - + get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + get_statements Returns all statements of a given type up to the specified block level. - + get_variable_usages Returns all instances of variable usages in a code block. - + indent Adjusts the indentation level of the entire code block. - + insert_after Inserts source code at the bottom of the code block. - + insert_before Inserts new source code at the top of the code block. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -420,7 +420,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -428,7 +428,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -436,7 +436,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -444,7 +444,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -452,7 +452,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename_variable_usages Renames all instances of variable usages in the code block. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Extracts a code block from its parent wrapper container by removing the wrapping - + None } description=""/> @@ -588,7 +588,7 @@ Extracts a code block from its parent wrapper container by removing the wrapping ### wrap Wraps a code block with a statement and indents it. - + + ## Attributes @@ -65,7 +65,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### files Recursively iterate over all files in the codebase that are owned by the current code owner. - + Iterable[TFile] } description=""/> @@ -73,7 +73,7 @@ Recursively iterate over all files in the codebase that are owned by the current ### from_parser Create a list of CodeOwner objects from a CodeOwnersParser. - + get_class Get a class by name in files container. - + Class | None } description=""/> @@ -104,7 +104,7 @@ Get a class by name in files container. ### get_export Get an export by name in files container (supports only typescript). - + TSExport | None } description=""/> @@ -112,7 +112,7 @@ Get an export by name in files container (supports only typescript). ### get_function Get a function by name in files container. - + Function | None } description=""/> @@ -120,7 +120,7 @@ Get a function by name in files container. ### get_global_var Get a global variable by name in files container. - + Assignment | None } description=""/> @@ -128,7 +128,7 @@ Get a global variable by name in files container. ### get_import Get an import by name in files container. - + Import | None } description=""/> @@ -136,7 +136,7 @@ Get an import by name in files container. ### get_import_statement Get an import statement by name in files container. - + ImportStatement | None } description=""/> @@ -144,7 +144,7 @@ Get an import statement by name in files container. ### get_symbol Get a symbol by name in files container. - + Symbol | None } description=""/> diff --git a/docs/_deprecated/api-reference/core/Codebase.mdx b/docs/api-reference/core/Codebase.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Codebase.mdx rename to docs/api-reference/core/Codebase.mdx index 339a6c71f..7cc417782 100644 --- a/docs/_deprecated/api-reference/core/Codebase.mdx +++ b/docs/api-reference/core/Codebase.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -89,7 +89,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ai Generates a response from the AI based on the provided prompt, target, and context. - + checkout Checks out a git branch or commit and syncs the codebase graph to the new state. - + commit Commits all staged changes to the codebase graph and synchronizes the graph with the filesystem if specified. - + create_directory Creates a directory at the specified path. - + create_file Creates a new file in the codebase with specified content. - + create_pr Creates a pull request from the current branch to the repository's default branch. - + create_pr_comment Create a comment on a pull request - + None } description=""/> @@ -265,7 +265,7 @@ Create a comment on a pull request ### create_pr_review_comment Create a review comment on a pull request. - + None } description=""/> @@ -273,7 +273,7 @@ Create a review comment on a pull request. ### files A list property that returns all files in the codebase. - + list[ SourceFile ] | list[ File ] } description="A sorted list of source files in the codebase."/> @@ -281,7 +281,7 @@ A list property that returns all files in the codebase. ### find_by_span Finds editable objects that overlap with the given source code span. - + from_files Creates a Codebase instance from multiple files. - + Codebase } description="A Codebase instance initialized with the provided files"/> @@ -306,7 +306,7 @@ Creates a Codebase instance from multiple files. ### from_repo Fetches a codebase from GitHub and returns a Codebase instance. - + from_string Creates a Codebase instance from a string of code. - + Codebase } description="A Codebase instance initialized with the provided code Example: >>> # Python code >>> code = "def add(a, b): return a + b" >>> codebase = Codebase.from_string(code, language="python") >>> # TypeScript code >>> code = "function add(a: number, b: number): number { return a + b; }" >>> codebase = Codebase.from_string(code, language="typescript")"/> @@ -367,7 +367,7 @@ Creates a Codebase instance from a string of code. ### get_class Returns a class that matches the given name. - + get_directory Returns Directory by `dir_path`, or full path to the directory from codebase root. - + get_file Retrieves a file from the codebase by its filepath. - + get_function Retrieves a function from the codebase by its name. - + get_modified_symbols_in_pr Get all modified symbols in a pull request - + tuple[str, dict[str, str], list[str], str] } description=""/> @@ -473,7 +473,7 @@ Get all modified symbols in a pull request ### get_relative_path Calculates a relative path from one file to another, removing the extension from the target file. - + get_symbol Returns a Symbol by name from the codebase. - + get_symbols Retrieves all symbols in the codebase that match the given symbol name. - + git_commit Stages + commits all changes to the codebase and git. - + has_directory Returns a boolean indicating if a directory exists in the codebase. - + has_file Determines if a file exists in the codebase. - + has_symbol Returns whether a symbol exists in the codebase. - + reset Resets the codebase by - + None } description=""/> @@ -624,7 +624,7 @@ Resets the codebase by ### set_ai_key Sets the OpenAI key for the current Codebase instance. - + None } description=""/> @@ -632,7 +632,7 @@ Sets the OpenAI key for the current Codebase instance. ### set_session_options Sets the session options for the current codebase. - + should_fix Returns True if the flag should be fixed based on the current mode and active group. - + visualize Visualizes a NetworkX graph or Plotly figure. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Comment ] } description=""/> @@ -201,7 +201,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -314,7 +314,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -322,7 +322,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -330,7 +330,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -338,7 +338,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -346,7 +346,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ CommentGroup ] } description=""/> @@ -197,7 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -310,7 +310,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,7 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -334,7 +334,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -342,7 +342,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [BinaryExpression](/api-reference/core/BinaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ComparisonExpression ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a binary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Decorator ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Dict ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes @@ -77,7 +77,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### files Gets a list of all top level files in the directory. - + list[TFile] } description="A sorted list of source files in the codebase."/> @@ -85,7 +85,7 @@ Gets a list of all top level files in the directory. ### get_class Get a class by name in files container. - + Class | None } description=""/> @@ -93,7 +93,7 @@ Get a class by name in files container. ### get_export Get an export by name in files container (supports only typescript). - + TSExport | None } description=""/> @@ -101,7 +101,7 @@ Get an export by name in files container (supports only typescript). ### get_file Get a file by its name relative to the directory. - + TFile | None } description=""/> @@ -109,7 +109,7 @@ Get a file by its name relative to the directory. ### get_function Get a function by name in files container. - + Function | None } description=""/> @@ -117,7 +117,7 @@ Get a function by name in files container. ### get_global_var Get a global variable by name in files container. - + Assignment | None } description=""/> @@ -125,7 +125,7 @@ Get a global variable by name in files container. ### get_import Get an import by name in files container. - + Import | None } description=""/> @@ -133,7 +133,7 @@ Get an import by name in files container. ### get_import_statement Get an import statement by name in files container. - + ImportStatement | None } description=""/> @@ -141,7 +141,7 @@ Get an import statement by name in files container. ### get_subdirectory Get a subdirectory by its name (relative to the directory). - + Directory | None } description=""/> @@ -149,7 +149,7 @@ Get a subdirectory by its name (relative to the directory). ### get_symbol Get a symbol by name in files container. - + Symbol | None } description=""/> @@ -157,7 +157,7 @@ Get a symbol by name in files container. ### items Get a list of all files and subdirectories in the directory. - + list[ Directory | TFile] } description="A sorted list of files and subdirectories in the directory."/> @@ -165,7 +165,7 @@ Get a list of all files and subdirectories in the directory. ### remove Remove all the files in the files container. - + None } description=""/> @@ -173,7 +173,7 @@ Remove all the files in the files container. ### rename Rename the directory. - + None } description=""/> @@ -181,7 +181,7 @@ Rename the directory. ### subdirectories Get a list of all top level subdirectories in the directory. - + list[ Directory ] } description="A sorted list of subdirectories in the directory."/> @@ -189,7 +189,7 @@ Get a list of all top level subdirectories in the directory. ### update_filepath Update the filepath of the directory and its contained files. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/core/Editable.mdx b/docs/api-reference/core/Editable.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Editable.mdx rename to docs/api-reference/core/Editable.mdx index 32a338214..6fdecc380 100644 --- a/docs/_deprecated/api-reference/core/Editable.mdx +++ b/docs/api-reference/core/Editable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -65,7 +65,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -73,7 +73,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Editable ] } description=""/> @@ -162,7 +162,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -275,7 +275,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -283,7 +283,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -291,7 +291,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -299,7 +299,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -307,7 +307,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Exportable](/api-reference/core/Exportable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -115,7 +115,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Export ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -270,7 +270,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_aliased Determines if the Export object is aliased. - + bool } description="True if the exported symbol has a different name than the name it is exported as, False otherwise."/> @@ -383,7 +383,7 @@ Determines if the Export object is aliased. ### is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -391,7 +391,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_module_export Determines if the export is a module-level export. - + bool } description="True if the export is a module-level export, False otherwise."/> @@ -399,7 +399,7 @@ Determines if the export is a module-level export. ### is_named_export Determines if the export is named or default. - + bool } description="True if the export is named, False if it is default."/> @@ -407,7 +407,7 @@ Determines if the export is named or default. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -415,7 +415,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -423,7 +423,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -431,7 +431,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -439,7 +439,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ExportStatement ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Exportable ] } description=""/> @@ -215,7 +215,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -258,7 +258,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -371,7 +371,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -379,7 +379,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -387,7 +387,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -395,7 +395,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Expression ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ExpressionGroup ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ExpressionStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -407,7 +407,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Callable](/api-reference/core/Callable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ExternalModule ] } description=""/> @@ -211,7 +211,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_import Creates an ExternalModule instance from an Import instance. - + get_import_string Returns the import string used to import this module. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -271,7 +271,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -435,7 +435,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -443,7 +443,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -451,7 +451,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -459,7 +459,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -467,7 +467,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this file with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ File ] } description=""/> @@ -200,7 +200,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -313,7 +313,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,7 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -337,7 +337,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parse Parses the file representation into the graph. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -362,7 +362,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -370,7 +370,7 @@ Removes the file from the file system and graph. ### rename Renames the file to the specified name, preserving the file extension. - + replace Replace occurrences of text in the file. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + update_filepath Updates the file path and inbound imports of a file. - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/ForLoopStatement.mdx b/docs/api-reference/core/ForLoopStatement.mdx similarity index 88% rename from docs/_deprecated/api-reference/core/ForLoopStatement.mdx rename to docs/api-reference/core/ForLoopStatement.mdx index 307080414..f1fa3be5a 100644 --- a/docs/_deprecated/api-reference/core/ForLoopStatement.mdx +++ b/docs/api-reference/core/ForLoopStatement.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Expression](/api-reference/core/Expression), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ForLoopStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -340,7 +340,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -348,7 +348,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -364,7 +364,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -372,7 +372,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Callable](/api-reference/core/Callable), [Symbol](/api-reference/core/Symbol), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -171,7 +171,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_statements Adds statements to the end of a function body. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -253,7 +253,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -261,7 +261,7 @@ Modifies the function to be asynchronous. ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Function ] } description=""/> @@ -373,7 +373,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -381,7 +381,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + insert_statements Inserts lines of code into the function body at the specified index. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -574,7 +574,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -582,7 +582,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -619,7 +619,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -627,7 +627,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### prepend_statements Prepends the provided code to the beginning of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -652,7 +652,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Converts the function call to an async function call by wrapping it with 'await'. - + None } description=""/> @@ -135,7 +135,7 @@ Converts the function call to an async function call by wrapping it with 'await' ### convert_args_to_kwargs Converts positional arguments in a function call to keyword arguments. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ FunctionCall ] } description=""/> @@ -241,7 +241,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_usage Creates a FunctionCall object from an Editable instance that represents a function call. - + get_arg_by_index Returns the Argument with the given index from the function call's argument list. - + get_arg_by_parameter_name Returns an argument by its parameter name. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -306,7 +306,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -419,7 +419,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -427,7 +427,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -435,7 +435,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -443,7 +443,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -451,7 +451,7 @@ Reduces an editable to the following condition ### remove Removes a node and optionally its related extended nodes. - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_kwarg Set a keyword argument in a function call. - + set_name Sets the name of a code element. - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ GenericType ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -118,7 +118,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ HasBlock ] } description=""/> @@ -207,7 +207,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -320,7 +320,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -328,7 +328,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -336,7 +336,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ## Attributes @@ -29,7 +29,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -37,7 +37,7 @@ Returns the name node of the object. ### rename Sets the name of an object and updates all its usages. - + set_name Sets the name of a code element. - + + ## Attributes @@ -25,7 +25,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -119,7 +119,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + elif_statements Returns all elif blocks within the if block. - + list[ IfBlockStatement ] } description="A list of elif block statements. Empty list if no elif blocks exist."/> @@ -162,7 +162,7 @@ Returns all elif blocks within the if block. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ IfBlockStatement ] } description=""/> @@ -216,7 +216,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -329,7 +329,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -337,7 +337,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -345,7 +345,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -353,7 +353,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a conditional block by reducing its condition to a boolean value. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -135,7 +135,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -143,7 +143,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Import ] } description=""/> @@ -255,7 +255,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -263,7 +263,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_aliased_import Returns True if this import is aliased. - + bool } description="True if the import has an alias different from its original name, False otherwise."/> @@ -376,7 +376,7 @@ Returns True if this import is aliased. ### is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -384,7 +384,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_module_import Returns True if this import is importing an entire module/file. - + bool } description="True if this import represents a module/file import, False if it represents a symbol import."/> @@ -392,7 +392,7 @@ Returns True if this import is importing an entire module/file. ### is_reexport Returns true if the Import object is also an Export object. - + bool } description="True if the import is re-exported, False otherwise."/> @@ -400,7 +400,7 @@ Returns true if the Import object is also an Export object. ### is_symbol_import Returns True if this import is importing a symbol rather than a module. - + bool } description="True if this import is a symbol import, False if it is a module import."/> @@ -408,7 +408,7 @@ Returns True if this import is importing a symbol rather than a module. ### is_wildcard_import Returns True if the import symbol is a wildcard import. - + bool } description="True if this is a wildcard import, False otherwise."/> @@ -416,7 +416,7 @@ Returns True if the import symbol is a wildcard import. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -424,7 +424,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -432,7 +432,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -440,7 +440,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -448,7 +448,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ImportStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/Importable.mdx b/docs/api-reference/core/Importable.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Importable.mdx rename to docs/api-reference/core/Importable.mdx index f3b636a9f..0adedba8c 100644 --- a/docs/_deprecated/api-reference/core/Importable.mdx +++ b/docs/api-reference/core/Importable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Importable ] } description=""/> @@ -199,7 +199,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -207,7 +207,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -320,7 +320,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -328,7 +328,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -336,7 +336,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Symbol](/api-reference/core/Symbol), [Editable](/api-reference/core/Editable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -123,7 +123,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -188,7 +188,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + extends Returns True if the interface implements the given parent interface. - + bool } description=""/> @@ -254,7 +254,7 @@ Returns True if the interface implements the given parent interface. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Interface ] } description=""/> @@ -308,7 +308,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns the attribute with the given name, if it exists. - + Attribute | None } description=""/> @@ -316,7 +316,7 @@ Returns the attribute with the given name, if it exists. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -324,7 +324,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + implementations Returns all classes and interfaces that implement a given interface. - + list[ TSInterface | Class ] } description=""/> @@ -355,7 +355,7 @@ Returns all classes and interfaces that implement a given interface. ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -451,7 +451,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -459,7 +459,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -496,7 +496,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -504,7 +504,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -512,7 +512,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -91,7 +91,7 @@ Edit the source for this Collection instance. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ List ] } description=""/> @@ -145,7 +145,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -176,7 +176,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -184,7 +184,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -274,7 +274,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -282,7 +282,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -290,7 +290,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -306,7 +306,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/MultiExpression.mdx b/docs/api-reference/core/MultiExpression.mdx similarity index 87% rename from docs/_deprecated/api-reference/core/MultiExpression.mdx rename to docs/api-reference/core/MultiExpression.mdx index 57c1e1294..cde892d2e 100644 --- a/docs/_deprecated/api-reference/core/MultiExpression.mdx +++ b/docs/api-reference/core/MultiExpression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ MultiExpression ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -95,7 +95,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ MultiLineCollection ] } description=""/> @@ -149,7 +149,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -180,7 +180,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -188,7 +188,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -278,7 +278,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -286,7 +286,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -294,7 +294,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -302,7 +302,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -310,7 +310,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Name ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ NamedType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -184,7 +184,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ NoneType ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Number ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Pair ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -289,7 +289,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -115,7 +115,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Parameter ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -235,7 +235,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -348,7 +348,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -356,7 +356,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -364,7 +364,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -372,7 +372,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -380,7 +380,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ParenthesizedExpression ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -410,7 +410,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + unwrap Removes the parentheses from a parenthesized expression node. - + + @@ -19,7 +19,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Replaces the content of a placeholder node with new source code. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/core/PlaceholderType.mdx b/docs/api-reference/core/PlaceholderType.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/PlaceholderType.mdx rename to docs/api-reference/core/PlaceholderType.mdx index a846e47cd..9e8d18973 100644 --- a/docs/_deprecated/api-reference/core/PlaceholderType.mdx +++ b/docs/api-reference/core/PlaceholderType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PlaceholderType ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ RaiseStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ReturnStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -163,7 +163,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + add_import Adds an import to the file. - + add_symbol Adds `symbol` to the file. - + add_symbol_from_source Adds a symbol to a file from a string representation. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -269,7 +269,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this file with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SourceFile ] } description=""/> @@ -398,7 +398,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -474,7 +474,7 @@ Returns the name node of the object. ### get_symbol Gets a symbol by its name from the file. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -621,7 +621,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -629,7 +629,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -637,7 +637,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -645,7 +645,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -653,7 +653,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -661,7 +661,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -669,7 +669,7 @@ Removes unused exports from the file. ### rename Renames a symbol and updates all its references in the codebase. - + replace Replace occurrences of text in the file. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if the file type supports adding the given symbol. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ Symbol | Class | Function | Assignment | TSInterface ] } description="A list of all top-level symbols in the file, sorted by their position in the file. Symbols can be one of the following types: - Symbol: Base symbol class - TClass: Class definition - TFunction: Function definition - TGlobalVar: Global variable assignment - TInterface: Interface definition"/> @@ -838,7 +838,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Renames the file and updates all imports to point to the new location. - + usages Returns a list of usages of the exportable object. - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/Statement.mdx b/docs/api-reference/core/Statement.mdx similarity index 87% rename from docs/_deprecated/api-reference/core/Statement.mdx rename to docs/api-reference/core/Statement.mdx index b103c92c6..2f84c7cc5 100644 --- a/docs/_deprecated/api-reference/core/Statement.mdx +++ b/docs/api-reference/core/Statement.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Statement ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/String.mdx b/docs/api-reference/core/String.mdx similarity index 87% rename from docs/_deprecated/api-reference/core/String.mdx rename to docs/api-reference/core/String.mdx index 4f8e8c378..74d45d964 100644 --- a/docs/_deprecated/api-reference/core/String.mdx +++ b/docs/api-reference/core/String.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ String ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -21,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the source code of this placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/core/SubscriptExpression.mdx b/docs/api-reference/core/SubscriptExpression.mdx similarity index 87% rename from docs/_deprecated/api-reference/core/SubscriptExpression.mdx rename to docs/api-reference/core/SubscriptExpression.mdx index bf69eba81..05904c59f 100644 --- a/docs/_deprecated/api-reference/core/SubscriptExpression.mdx +++ b/docs/api-reference/core/SubscriptExpression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SubscriptExpression ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -289,7 +289,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [BlockStatement](/api-reference/core/BlockStatement), [Statement](/api-reference/core/Statement), [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SwitchCase ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SwitchStatement ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -137,7 +137,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Symbol ] } description=""/> @@ -249,7 +249,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -257,7 +257,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -376,7 +376,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -384,7 +384,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -421,7 +421,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -429,7 +429,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -437,7 +437,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SymbolGroup ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -289,7 +289,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SymbolStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TernaryExpression ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TryCatchStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -91,7 +91,7 @@ Edit the source for this Collection instance. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Tuple ] } description=""/> @@ -145,7 +145,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -176,7 +176,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -184,7 +184,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -274,7 +274,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -282,7 +282,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -290,7 +290,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -306,7 +306,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -99,7 +99,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TupleType ] } description=""/> @@ -153,7 +153,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -184,7 +184,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -192,7 +192,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -282,7 +282,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -290,7 +290,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -306,7 +306,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,7 +314,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Type ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [HasBlock](/api-reference/core/HasBlock), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -123,7 +123,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -188,7 +188,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TypeAlias ] } description=""/> @@ -300,7 +300,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Get attribute by name. - + Attribute | None } description=""/> @@ -308,7 +308,7 @@ Get attribute by name. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -316,7 +316,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -435,7 +435,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -443,7 +443,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -480,7 +480,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -488,7 +488,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -496,7 +496,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -21,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the type annotation of a placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/core/Typeable.mdx b/docs/api-reference/core/Typeable.mdx similarity index 87% rename from docs/_deprecated/api-reference/core/Typeable.mdx rename to docs/api-reference/core/Typeable.mdx index 2c1d99f37..71e5c2bb8 100644 --- a/docs/_deprecated/api-reference/core/Typeable.mdx +++ b/docs/api-reference/core/Typeable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Typeable ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ UnaryExpression ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a unary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -99,7 +99,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ UnionType ] } description=""/> @@ -153,7 +153,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -184,7 +184,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -192,7 +192,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -282,7 +282,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -290,7 +290,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -306,7 +306,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,7 +314,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Unpack ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -395,7 +395,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + unwrap Unwraps a node's content into its parent node. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Unwrappable ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Unwrap this expression, removing parenthesis and other syntax elements while maintaining the function of the code. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/core/Usable.mdx b/docs/api-reference/core/Usable.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Usable.mdx rename to docs/api-reference/core/Usable.mdx index 2a61b45d9..910bd852b 100644 --- a/docs/_deprecated/api-reference/core/Usable.mdx +++ b/docs/api-reference/core/Usable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Usable ] } description=""/> @@ -199,7 +199,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -207,7 +207,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -320,7 +320,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -328,7 +328,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -336,7 +336,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ## Attributes diff --git a/docs/_deprecated/api-reference/core/UsageKind.mdx b/docs/api-reference/core/UsageKind.mdx similarity index 95% rename from docs/_deprecated/api-reference/core/UsageKind.mdx rename to docs/api-reference/core/UsageKind.mdx index b71860ec2..2c716f1da 100644 --- a/docs/_deprecated/api-reference/core/UsageKind.mdx +++ b/docs/api-reference/core/UsageKind.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes diff --git a/docs/_deprecated/api-reference/core/UsageType.mdx b/docs/api-reference/core/UsageType.mdx similarity index 89% rename from docs/_deprecated/api-reference/core/UsageType.mdx rename to docs/api-reference/core/UsageType.mdx index 4455a7ecd..a38a8ff12 100644 --- a/docs/_deprecated/api-reference/core/UsageType.mdx +++ b/docs/api-reference/core/UsageType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes diff --git a/docs/_deprecated/api-reference/core/Value.mdx b/docs/api-reference/core/Value.mdx similarity index 86% rename from docs/_deprecated/api-reference/core/Value.mdx rename to docs/api-reference/core/Value.mdx index 5dc12a5fc..7d2fbacc6 100644 --- a/docs/_deprecated/api-reference/core/Value.mdx +++ b/docs/api-reference/core/Value.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Value ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ WhileStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [Statement](/api-reference/core/Statement), [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ WithStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + Use the search bar (⌘ K) to quickly find specific APIs and functionality. diff --git a/docs/_deprecated/api-reference/python/PyAssignment.mdx b/docs/api-reference/python/PyAssignment.mdx similarity index 88% rename from docs/_deprecated/api-reference/python/PyAssignment.mdx rename to docs/api-reference/python/PyAssignment.mdx index c791e6655..03421868a 100644 --- a/docs/_deprecated/api-reference/python/PyAssignment.mdx +++ b/docs/api-reference/python/PyAssignment.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PySymbol](/api-reference/python/PySymbol), [Assignment](/api-reference/core/Assignment), [Symbol](/api-reference/core/Symbol), [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -179,7 +179,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a Python symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ PyAssignment ] } description="The code flag object for tracking purposes"/> @@ -291,7 +291,7 @@ Flags a Python symbol by adding a flag comment and returning a CodeFlag. ### from_named_expression Creates a MultiExpression from a Python named expression. - + get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -369,7 +369,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -488,7 +488,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -496,7 +496,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -504,7 +504,7 @@ Retrieves all usages of the assigned variable within its code block scope. ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -541,7 +541,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -549,7 +549,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this assignment and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [AssignmentStatement](/api-reference/core/AssignmentStatement), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyAssignmentStatement ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_assignment Creates a PyAssignmentStatement instance from a TreeSitter assignment node. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -362,7 +362,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -370,7 +370,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -378,7 +378,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -386,7 +386,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -394,7 +394,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [PyAssignmentStatement](/api-reference/python/PyAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyAttribute ] } description=""/> @@ -239,7 +239,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_assignment Creates a PyAssignmentStatement instance from a TreeSitter assignment node. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -300,7 +300,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -413,7 +413,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -421,7 +421,7 @@ Check if this node is contained another node of the given class ### local_usages Returns all instances where this attribute is used within its parent code block. - + list[ Editable [ PyAttribute ]] } description="A sorted list of unique attribute references. Each reference is an Editable object representing a usage of this attribute."/> @@ -429,7 +429,7 @@ Returns all instances where this attribute is used within its parent code block. ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -437,7 +437,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -445,7 +445,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -453,7 +453,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -130,7 +130,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyBlockStatement ] } description=""/> @@ -219,7 +219,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -332,7 +332,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -340,7 +340,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -348,7 +348,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -364,7 +364,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyBreakStatement ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyCatchStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyChainedAttribute ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [PySymbol](/api-reference/python/PySymbol), [Class](/api-reference/core/Class), [HasBlock](/api-reference/core/HasBlock), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -151,7 +151,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds an attribute to a class from raw source code, placing it in a specific location - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_source Adds source code to the class definition. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -291,7 +291,7 @@ Find all ancestors of the node of the given type. Does not return itself ### attributes Retrieves all attributes from this Class including those from its superclasses up to a - + dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a Python symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ PyClass ] } description="The code flag object for tracking purposes"/> @@ -426,7 +426,7 @@ Flags a Python symbol by adding a flag comment and returning a CodeFlag. ### get_attribute Returns a specific attribute by name. - + get_import_string Generates an import string for a Python symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -503,7 +503,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -707,7 +707,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_subclass_of Checks if the class inherits from a specified parent class. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -738,7 +738,7 @@ Check if this node is contained another node of the given class ### methods Retrieves all methods that exist on this Class, including methods from superclasses, with - + move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -804,7 +804,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -812,7 +812,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -820,7 +820,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [CodeBlock](/api-reference/core/CodeBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyCodeBlock ] } description=""/> @@ -216,7 +216,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_assignments Returns a list of assignments with the specified variable name. - + get_attributes Returns attributes from the code block, with the option to include or exclude private - + get_comment Gets the first comment statement containing a specific text string. - + get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + get_statements Returns all statements of a given type up to the specified block level. - + get_variable_usages Returns all instances of variable usages in a code block. - + get_with_statements Gets with statements at a specific block level. - + indent Adjusts the indentation level of the entire code block. - + insert_after Inserts source code at the bottom of the code block. - + insert_before Inserts new source code at the top of the code block. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -441,7 +441,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -449,7 +449,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -457,7 +457,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -465,7 +465,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -473,7 +473,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename_variable_usages Renames all instances of variable usages in the code block. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Extracts a code block from its parent wrapper container by removing the wrapping - + None } description=""/> @@ -609,7 +609,7 @@ Extracts a code block from its parent wrapper container by removing the wrapping ### wrap Wraps a code block with a statement and indents it. - + + ### Inherits from [Comment](/api-reference/core/Comment), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### clean_comment Cleans a comment block by removing comment symbols, leading/trailing whitespace, and standardizing indentation. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyComment ] } description=""/> @@ -226,7 +226,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### generate_comment Converts text content into a Python comment block. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -374,7 +374,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -382,7 +382,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -390,7 +390,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -398,7 +398,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -406,7 +406,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [CommentGroup](/api-reference/core/CommentGroup), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyCommentGroup ] } description=""/> @@ -197,7 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -310,7 +310,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,7 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -334,7 +334,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -342,7 +342,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + to_google_docstring Convert a comment group into a Google-style docstring. - + + ## Attributes diff --git a/docs/_deprecated/api-reference/python/PyConditionalExpression.mdx b/docs/api-reference/python/PyConditionalExpression.mdx similarity index 88% rename from docs/_deprecated/api-reference/python/PyConditionalExpression.mdx rename to docs/api-reference/python/PyConditionalExpression.mdx index a5436bdcb..4caa1160c 100644 --- a/docs/_deprecated/api-reference/python/PyConditionalExpression.mdx +++ b/docs/api-reference/python/PyConditionalExpression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [TernaryExpression](/api-reference/core/TernaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyConditionalExpression ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Decorator](/api-reference/core/Decorator), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyDecorator ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [SourceFile](/api-reference/core/SourceFile), [HasBlock](/api-reference/core/HasBlock), [Usable](/api-reference/core/Usable), [File](/api-reference/core/File), [Expression](/api-reference/core/Expression), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -167,7 +167,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + add_import Adds an import to the file. - + add_symbol Adds `symbol` to the file. - + add_symbol_from_source Adds a symbol to a file from a string representation. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -273,7 +273,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this file with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyFile ] } description=""/> @@ -402,7 +402,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_extensions Returns the file extensions associated with Python files. - + list[str] } description="A list containing '.py' as the only Python file extension."/> @@ -427,7 +427,7 @@ Returns the file extensions associated with Python files. ### get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_import_insert_index Determines the index position where a new import statement should be inserted in a Python file. - + get_import_string Generates an import string for a symbol. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -538,7 +538,7 @@ Returns the name node of the object. ### get_symbol Gets a symbol by its name from the file. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -685,7 +685,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -693,7 +693,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -701,7 +701,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -709,7 +709,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -717,7 +717,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -725,7 +725,7 @@ Removes the file from the file system and graph. ### rename Renames a symbol and updates all its references in the codebase. - + replace Replace occurrences of text in the file. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if a Python symbol can be added to this Python source file. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ PySymbol | PyClass | PyFunction | PyAssignment | Interface ] } description="A list of all top-level symbols in the file, sorted by their position in the file. Symbols can be one of the following types: - Symbol: Base symbol class - TClass: Class definition - TFunction: Function definition - TGlobalVar: Global variable assignment - TInterface: Interface definition"/> @@ -912,7 +912,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Renames the file and updates all imports to point to the new location. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [ForLoopStatement](/api-reference/core/ForLoopStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyForLoopStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -340,7 +340,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -348,7 +348,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -364,7 +364,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -372,7 +372,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [PySymbol](/api-reference/python/PySymbol), [Function](/api-reference/core/Function), [HasBlock](/api-reference/core/HasBlock), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -187,7 +187,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_statements Adds statements to the end of a function body. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -287,7 +287,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -295,7 +295,7 @@ Modifies the function to be asynchronous. ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a Python symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ PyFunction ] } description="The code flag object for tracking purposes"/> @@ -407,7 +407,7 @@ Flags a Python symbol by adding a flag comment and returning a CodeFlag. ### get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -450,7 +450,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + insert_statements Inserts lines of code into the function body at the specified index. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -643,7 +643,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -651,7 +651,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -688,7 +688,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -696,7 +696,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### prepend_statements Prepends statements to the start of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -721,7 +721,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets or modifies the return type annotation of a function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyNamedType](/api-reference/python/PyNamedType), [GenericType](/api-reference/core/GenericType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyGenericType ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -118,7 +118,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyHasBlock ] } description=""/> @@ -207,7 +207,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -320,7 +320,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -328,7 +328,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -336,7 +336,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -119,7 +119,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + elif_statements Returns all elif blocks within the if block. - + list[ PyIfBlockStatement ] } description="A list of elif block statements. Empty list if no elif blocks exist."/> @@ -162,7 +162,7 @@ Returns all elif blocks within the if block. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyIfBlockStatement ] } description=""/> @@ -216,7 +216,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -329,7 +329,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -337,7 +337,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -345,7 +345,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -353,7 +353,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a conditional block by reducing its condition to a boolean value. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Import](/api-reference/core/Import), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -135,7 +135,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -143,7 +143,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyImport ] } description=""/> @@ -255,7 +255,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Generates an import string for a Python import statement. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -298,7 +298,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_aliased_import Returns True if this import is aliased. - + bool } description="True if the import has an alias different from its original name, False otherwise."/> @@ -411,7 +411,7 @@ Returns True if this import is aliased. ### is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -419,7 +419,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_module_import Determines if the import is a module-level or wildcard import. - + bool } description="True if the import is a module-level or wildcard import, False otherwise."/> @@ -427,7 +427,7 @@ Determines if the import is a module-level or wildcard import. ### is_reexport Returns true if the Import object is also an Export object. - + bool } description="True if the import is re-exported, False otherwise."/> @@ -435,7 +435,7 @@ Returns true if the Import object is also an Export object. ### is_symbol_import Returns True if this import is importing a symbol rather than a module. - + bool } description="True if this import is a symbol import, False if it is a module import."/> @@ -443,7 +443,7 @@ Returns True if this import is importing a symbol rather than a module. ### is_wildcard_import Returns True if the import symbol is a wildcard import. - + bool } description="True if this is a wildcard import, False otherwise."/> @@ -451,7 +451,7 @@ Returns True if the import symbol is a wildcard import. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -459,7 +459,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -467,7 +467,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -475,7 +475,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -483,7 +483,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyImportStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [SwitchCase](/api-reference/core/SwitchCase), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyMatchCase ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -336,7 +336,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -344,7 +344,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -352,7 +352,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -360,7 +360,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyMatchStatement ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyNamedType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -184,7 +184,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_trailing_comment Add a trailing comment to a parameter in a function signature. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -132,7 +132,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyParameter ] } description=""/> @@ -244,7 +244,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -252,7 +252,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -365,7 +365,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -373,7 +373,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -381,7 +381,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -389,7 +389,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -397,7 +397,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation of a parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyPassStatement ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -21,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits or creates a return type annotation for a method or function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/python/PyString.mdx b/docs/api-reference/python/PyString.mdx similarity index 87% rename from docs/_deprecated/api-reference/python/PyString.mdx rename to docs/api-reference/python/PyString.mdx index 4d451bb38..0a3b980f8 100644 --- a/docs/_deprecated/api-reference/python/PyString.mdx +++ b/docs/api-reference/python/PyString.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyString ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -159,7 +159,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a Python symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ PySymbol ] } description="The code flag object for tracking purposes"/> @@ -271,7 +271,7 @@ Flags a Python symbol by adding a flag comment and returning a CodeFlag. ### get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + Name | PyChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -314,7 +314,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -433,7 +433,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -441,7 +441,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -478,7 +478,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -486,7 +486,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -494,7 +494,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyTryCatchStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -340,7 +340,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -348,7 +348,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -364,7 +364,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -372,7 +372,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [UnionType](/api-reference/core/UnionType), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -99,7 +99,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyUnionType ] } description=""/> @@ -153,7 +153,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -184,7 +184,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -192,7 +192,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -282,7 +282,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -290,7 +290,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -306,7 +306,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,7 +314,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyWhileStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -340,7 +340,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -348,7 +348,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -364,7 +364,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -372,7 +372,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_prop Adds a new prop to a JSXElement. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -126,7 +126,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ JSXElement ] } description=""/> @@ -215,7 +215,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -223,7 +223,7 @@ Returns the name node of the object. ### get_prop Returns the JSXProp with the given name from the JSXElement. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -353,7 +353,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -361,7 +361,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -369,7 +369,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -377,7 +377,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -385,7 +385,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a JSXElement by modifying both opening and closing tags. - + wrap Wraps the current JSXElement with the provided opening and closing tags, properly handling indentation. - + + ### Inherits from [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ JSXExpression ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a JSX expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Removes the brackets from a JSX expression. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/typescript/JSXProp.mdx b/docs/api-reference/typescript/JSXProp.mdx similarity index 86% rename from docs/_deprecated/api-reference/typescript/JSXProp.mdx rename to docs/api-reference/typescript/JSXProp.mdx index 28b299f4a..c592aaf16 100644 --- a/docs/_deprecated/api-reference/typescript/JSXProp.mdx +++ b/docs/api-reference/typescript/JSXProp.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ JSXProp ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -192,7 +192,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after a JSX prop in a TypeScript/JSX file. - + insert_before Insert a new source code string before a JSX prop in a React component. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -305,7 +305,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -313,7 +313,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSNamedType](/api-reference/typescript/TSNamedType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSArrayType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -184,7 +184,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [TSSymbol](/api-reference/typescript/TSSymbol), [Assignment](/api-reference/core/Assignment), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -139,7 +139,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -199,7 +199,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSAssignment ] } description="The code flag object for tracking purposes"/> @@ -311,7 +311,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### from_named_expression Creates a MultiExpression object from a TypeScript named expression node. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -389,7 +389,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -508,7 +508,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -516,7 +516,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -524,7 +524,7 @@ Retrieves all usages of the assigned variable within its code block scope. ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -561,7 +561,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -569,7 +569,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment for an assignment node. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [AssignmentStatement](/api-reference/core/AssignmentStatement), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSAssignmentStatement ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -309,7 +309,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -333,7 +333,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -341,7 +341,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSAssignmentStatement](/api-reference/typescript/TSAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSAttribute ] } description=""/> @@ -239,7 +239,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -247,7 +247,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -360,7 +360,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -368,7 +368,7 @@ Check if this node is contained another node of the given class ### local_usages Returns local usages of a TypeScript attribute within its code block. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -393,7 +393,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -401,7 +401,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -409,7 +409,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSBlockStatement ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -353,7 +353,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -361,7 +361,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -369,7 +369,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -377,7 +377,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -385,7 +385,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSCatchStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -357,7 +357,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -365,7 +365,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -373,7 +373,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -381,7 +381,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -389,7 +389,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSChainedAttribute ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [Class](/api-reference/core/Class), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -179,7 +179,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds a class attribute from source code to a TypeScript/JavaScript class. - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_source Adds source code to a class body. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -319,7 +319,7 @@ Find all ancestors of the node of the given type. Does not return itself ### attributes Retrieves all attributes from this Class including those from its superclasses up to a - + class_component_to_function_component Converts a class component to a function component. - + None } description=""/> @@ -350,7 +350,7 @@ Converts a class component to a function component. ### convert_props_to_interface Converts React component props to TypeScript interfaces. - + None } description=""/> @@ -358,7 +358,7 @@ Converts React component props to TypeScript interfaces. ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSClass ] } description="The code flag object for tracking purposes"/> @@ -470,7 +470,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_attribute Returns a specific attribute by name. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -564,7 +564,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -768,7 +768,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_subclass_of Checks if the class inherits from a specified parent class. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -799,7 +799,7 @@ Check if this node is contained another node of the given class ### methods Retrieves all methods that exist on this Class, including methods from superclasses, with - + move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -865,7 +865,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -873,7 +873,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -881,7 +881,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [CodeBlock](/api-reference/core/CodeBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -123,7 +123,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSCodeBlock ] } description=""/> @@ -212,7 +212,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_assignments Returns a list of assignments with the specified variable name. - + get_attributes Returns attributes from the code block, with the option to include or exclude private - + get_comment Gets the first comment statement containing a specific text string. - + get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + get_statements Returns all statements of a given type up to the specified block level. - + get_variable_usages Returns all instances of variable usages in a code block. - + indent Adjusts the indentation level of the entire code block. - + insert_after Inserts source code at the bottom of the code block. - + insert_before Inserts new source code at the top of the code block. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -420,7 +420,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -428,7 +428,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -436,7 +436,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -444,7 +444,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -452,7 +452,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename_variable_usages Renames all instances of variable usages in the code block. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Unwraps a code block by removing its opening and closing braces. - + None } description=""/> @@ -588,7 +588,7 @@ Unwraps a code block by removing its opening and closing braces. ### wrap Wraps a code block with a statement and indents it. - + + ### Inherits from [Comment](/api-reference/core/Comment), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### clean_comment Cleans comment markers and whitespace from a comment string. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSComment ] } description=""/> @@ -222,7 +222,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### generate_comment Generates a TypeScript comment block from the given text content. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -370,7 +370,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -378,7 +378,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -386,7 +386,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -394,7 +394,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -402,7 +402,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [CommentGroup](/api-reference/core/CommentGroup), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSCommentGroup ] } description=""/> @@ -197,7 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -310,7 +310,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,7 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -334,7 +334,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -342,7 +342,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ## Attributes diff --git a/docs/_deprecated/api-reference/typescript/TSConditionalType.mdx b/docs/api-reference/typescript/TSConditionalType.mdx similarity index 87% rename from docs/_deprecated/api-reference/typescript/TSConditionalType.mdx rename to docs/api-reference/typescript/TSConditionalType.mdx index 0df5bb9cf..a17f2fdaf 100644 --- a/docs/_deprecated/api-reference/typescript/TSConditionalType.mdx +++ b/docs/api-reference/typescript/TSConditionalType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSConditionalType ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes @@ -69,7 +69,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolve_base_url Resolves an import path with the base url. - + str } description=""/> @@ -77,7 +77,7 @@ Resolves an import path with the base url. ### translate_absolute_path Translates an absolute path to an import path using the tsconfig paths. - + translate_import_path Translates an import path to an absolute path using the tsconfig paths. - + + ### Inherits from [Decorator](/api-reference/core/Decorator), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSDecorator ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Dict](/api-reference/core/Dict), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSDict ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -147,7 +147,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -230,7 +230,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSEnum ] } description="The code flag object for tracking purposes"/> @@ -342,7 +342,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_attribute Returns an attribute from the TypeScript enum by its name. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -419,7 +419,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -538,7 +538,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -546,7 +546,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -583,7 +583,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -591,7 +591,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -599,7 +599,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Export](/api-reference/core/Export), [Editable](/api-reference/core/Editable), [Exportable](/api-reference/core/Exportable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -123,7 +123,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -131,7 +131,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSExport ] } description=""/> @@ -243,7 +243,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for this export. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -286,7 +286,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_aliased Determines if the Export object is aliased. - + bool } description="True if the exported symbol has a different name than the name it is exported as, False otherwise."/> @@ -399,7 +399,7 @@ Determines if the Export object is aliased. ### is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -407,7 +407,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_default_export Determines if an export is the default export for a file. - + bool } description="True if this is a default export, False otherwise."/> @@ -415,7 +415,7 @@ Determines if an export is the default export for a file. ### is_default_symbol_export Returns True if this is exporting a default symbol, as opposed to a default object export. - + is_module_export Determines if the export is exporting a module rather than a symbol. - + bool } description="True if the export represents a module export, False otherwise."/> @@ -440,7 +440,7 @@ Determines if the export is exporting a module rather than a symbol. ### is_named_export Determines whether this export is a named export. - + bool } description="True if this is a named export, False if it is a default export."/> @@ -448,7 +448,7 @@ Determines whether this export is a named export. ### is_reexport Returns whether the export is re-exporting an import or export. - + is_type_export Determines if this export is exclusively exporting a type. - + bool } description="True if this is a type-only export, False otherwise."/> @@ -473,7 +473,7 @@ Determines if this export is exclusively exporting a type. ### is_wildcard_export Determines if the export is a wildcard export. - + bool } description="True if the export is a wildcard export (e.g. 'export * from "./module"'), False otherwise."/> @@ -481,7 +481,7 @@ Determines if the export is a wildcard export. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -489,7 +489,7 @@ Check if this node is contained another node of the given class ### make_non_default Converts the export to a named export. - + None } description=""/> @@ -497,7 +497,7 @@ Converts the export to a named export. ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -505,7 +505,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -513,7 +513,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -521,7 +521,7 @@ Reduces an editable to the following condition ### reexport_symbol Returns the import object that is re-exporting this symbol. - + TSImport | None } description="The import object being re-exported, or None if this is not a re-export or no import was found."/> @@ -529,7 +529,7 @@ Returns the import object that is re-exporting this symbol. ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + to_import_string Converts this export into its equivalent import string representation. - + str } description="The import string representation of this export. Examples: - For `export { foo } from './bar'` -> `import { foo } from './bar'` - For `export * from './bar'` -> `import * as _namespace from './bar'` - For `export { default as foo } from './bar'` -> `import foo from './bar'`"/> @@ -710,7 +710,7 @@ Converts this export into its equivalent import string representation. ### usages Returns a list of usages of the exportable object. - + + ### Inherits from [TSNamedType](/api-reference/typescript/TSNamedType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSExpressionType ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Exportable](/api-reference/core/Exportable), [TSHasBlock](/api-reference/typescript/TSHasBlock), [SourceFile](/api-reference/core/SourceFile), [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -219,7 +219,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + add_export_to_symbol Adds an export keyword to a symbol in a TypeScript file. - + add_import Adds an import to the file. - + add_symbol Adds `symbol` to the file. - + add_symbol_from_source Adds a symbol to a file from a string representation. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -342,7 +342,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this file with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSFile ] } description=""/> @@ -471,7 +471,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_config Returns the nearest tsconfig.json applicable to this file. - + TSConfig | None } description="The TypeScript configuration object if found, None otherwise."/> @@ -513,7 +513,7 @@ Returns the nearest tsconfig.json applicable to this file. ### get_export Returns an export object with the specified name from the file. - + get_export_statement_for_path Gets the first export of specified type that contains the given path in single or double quotes. - + get_extensions Returns a list of file extensions that this class can parse. - + list[str] } description="A list of file extensions including '.tsx', '.ts', '.jsx', and '.js'."/> @@ -561,7 +561,7 @@ Returns a list of file extensions that this class can parse. ### get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_import_string Generates and returns an import statement for the file. - + get_interface Retrieves a specific interface from the file by its name. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -672,7 +672,7 @@ Returns the name node of the object. ### get_namespace Returns a specific namespace by name from the file's namespaces. - + get_symbol Gets a symbol by its name from the file. - + get_type Returns a specific Type by name from the file's types. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_export_statement_for_path Checks if the file has exports of specified type that contains the given path in single or double quotes. - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -876,7 +876,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -884,7 +884,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -892,7 +892,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -900,7 +900,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -908,7 +908,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -916,7 +916,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -924,7 +924,7 @@ Removes unused exports from the file. ### rename Renames a symbol and updates all its references in the codebase. - + replace Replace occurrences of text in the file. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + set_name Sets the name of a code element. - + symbol_can_be_added Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ TSSymbol | TSClass | TSFunction | TSAssignment | TSInterface ] } description="A list of all top-level symbols in the file, sorted by their position in the file. Symbols can be one of the following types: - Symbol: Base symbol class - TClass: Class definition - TFunction: Function definition - TGlobalVar: Global variable assignment - TInterface: Interface definition"/> @@ -1117,7 +1117,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Updates the file path of the current file and all associated imports. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [ForLoopStatement](/api-reference/core/ForLoopStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -127,7 +127,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -158,7 +158,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSForLoopStatement ] } description=""/> @@ -247,7 +247,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -377,7 +377,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -385,7 +385,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -393,7 +393,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -401,7 +401,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -409,7 +409,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [Function](/api-reference/core/Function), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -219,7 +219,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_statements Adds statements to the end of a function body. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -319,7 +319,7 @@ Find all ancestors of the node of the given type. Does not return itself ### arrow_to_named Converts an arrow function to a named function in TypeScript/JavaScript. - + asyncify Modifies the function to be asynchronous, if it is not already. - + None } description=""/> @@ -344,7 +344,7 @@ Modifies the function to be asynchronous, if it is not already. ### convert_props_to_interface Converts React component props to TypeScript interfaces. - + None } description=""/> @@ -352,7 +352,7 @@ Converts React component props to TypeScript interfaces. ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSFunction ] } description="The code flag object for tracking purposes"/> @@ -464,7 +464,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -524,7 +524,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + insert_statements Inserts lines of code into the function body at the specified index. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -717,7 +717,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_valid_node Determines if a given tree-sitter node corresponds to a valid function type. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -742,7 +742,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -779,7 +779,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -787,7 +787,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### prepend_statements Prepends the provided code to the beginning of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -812,7 +812,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function type to be asynchronous by wrapping its return type in a Promise. - + None } description=""/> @@ -99,7 +99,7 @@ Modifies the function type to be asynchronous by wrapping its return type in a P ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSFunctionType ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [GenericType](/api-reference/core/GenericType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSGenericType ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -188,7 +188,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -122,7 +122,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSHasBlock ] } description=""/> @@ -211,7 +211,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -341,7 +341,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -349,7 +349,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -357,7 +357,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -365,7 +365,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -373,7 +373,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -119,7 +119,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + elif_statements Returns all elif blocks within the if block. - + list[ TSIfBlockStatement ] } description="A list of elif block statements. Empty list if no elif blocks exist."/> @@ -162,7 +162,7 @@ Returns all elif blocks within the if block. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSIfBlockStatement ] } description=""/> @@ -216,7 +216,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -329,7 +329,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -337,7 +337,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -345,7 +345,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -353,7 +353,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a conditional block by reducing its condition to a boolean value. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Exportable](/api-reference/core/Exportable), [Import](/api-reference/core/Import), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -159,7 +159,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -167,7 +167,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSImport ] } description=""/> @@ -279,7 +279,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Generates an import string for an import statement. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -322,7 +322,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_aliased_import Returns True if this import is aliased. - + bool } description="True if the import has an alias different from its original name, False otherwise."/> @@ -435,7 +435,7 @@ Returns True if this import is aliased. ### is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -443,7 +443,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_default_import Determines whether the import is a default export import. - + is_module_import Determines if an import represents a module-level import. - + is_reexport Returns true if the Import object is also an Export object. - + bool } description="True if the import is re-exported, False otherwise."/> @@ -485,7 +485,7 @@ Returns true if the Import object is also an Export object. ### is_symbol_import Returns True if this import is importing a symbol rather than a module. - + bool } description="True if this import is a symbol import, False if it is a module import."/> @@ -493,7 +493,7 @@ Returns True if this import is importing a symbol rather than a module. ### is_type_import Checks if an import is a type import. - + bool } description="True if the import is a type import, False otherwise."/> @@ -501,7 +501,7 @@ Checks if an import is a type import. ### is_wildcard_import Returns True if the import symbol is a wildcard import. - + bool } description="True if this is a wildcard import, False otherwise."/> @@ -509,7 +509,7 @@ Returns True if the import symbol is a wildcard import. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -517,7 +517,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -525,7 +525,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -533,7 +533,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -541,7 +541,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve_import Resolves an import statement to its target file and symbol. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSImportStatement ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [Interface](/api-reference/core/Interface), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -151,7 +151,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -234,7 +234,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + extends Returns True if the interface implements the given parent interface. - + bool } description=""/> @@ -300,7 +300,7 @@ Returns True if the interface implements the given parent interface. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSInterface ] } description="The code flag object for tracking purposes"/> @@ -354,7 +354,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_attribute Returns the attribute with the given name, if it exists. - + TSAttribute | None } description=""/> @@ -362,7 +362,7 @@ Returns the attribute with the given name, if it exists. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -422,7 +422,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + implementations Returns all classes and interfaces that implement a given interface. - + list[ TSInterface | TSClass ] } description=""/> @@ -453,7 +453,7 @@ Returns all classes and interfaces that implement a given interface. ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -549,7 +549,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -557,7 +557,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -594,7 +594,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -602,7 +602,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -610,7 +610,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasName](/api-reference/core/HasName), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSLabeledStatement ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -317,7 +317,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -325,7 +325,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -333,7 +333,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -341,7 +341,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -349,7 +349,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSLookupType ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSNamedType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -184,7 +184,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasName](/api-reference/core/HasName), [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable) @@ -155,7 +155,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_symbol Adds a new symbol to the namespace, optionally exporting it if applicable. If the symbol already exists in the namespace, returns the existing symbol. - + TSSymbol | None } description="The existing symbol if it already exists in the file or None if it was added."/> @@ -238,7 +238,7 @@ Adds a new symbol to the namespace, optionally exporting it if applicable. If th ### add_symbol_from_source Adds a symbol to a namespace from a string representation. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -263,7 +263,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSNamespace ] } description="The code flag object for tracking purposes"/> @@ -375,7 +375,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_class Get a class by name from this namespace. - + TSClass | None } description=""/> @@ -383,7 +383,7 @@ Get a class by name from this namespace. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_enum Get an enum by name from this namespace. - + TSEnum | None } description=""/> @@ -408,7 +408,7 @@ Get an enum by name from this namespace. ### get_function Get a function by name from this namespace. - + TSFunction | None } description=""/> @@ -416,7 +416,7 @@ Get a function by name from this namespace. ### get_import_string Generates the appropriate import string for a symbol. - + get_interface Get an interface by name from this namespace. - + TSInterface | None } description=""/> @@ -459,7 +459,7 @@ Get an interface by name from this namespace. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -467,7 +467,7 @@ Returns the name node of the object. ### get_namespace Get a namespace by name from this namespace. - + TSNamespace | None } description="The found namespace, or None if not found"/> @@ -475,7 +475,7 @@ Get a namespace by name from this namespace. ### get_nested_namespaces Get all nested namespaces within this namespace. - + list[ TSNamespace ] } description="List of all nested namespace objects"/> @@ -483,7 +483,7 @@ Get all nested namespaces within this namespace. ### get_symbol Get an exported or private symbol by name from this namespace. Returns only exported symbols by default. - + TSSymbol | None } description="The found symbol, or None if not found"/> @@ -491,7 +491,7 @@ Get an exported or private symbol by name from this namespace. Returns only expo ### get_type Get a type alias by name from this namespace. - + TSTypeAlias | None } description=""/> @@ -499,7 +499,7 @@ Get a type alias by name from this namespace. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -618,7 +618,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -626,7 +626,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -663,7 +663,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -671,7 +671,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -679,7 +679,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + remove_symbol Removes a symbol from the namespace by name. - + TSSymbol | None } description=""/> @@ -716,7 +716,7 @@ Removes a symbol from the namespace by name. ### rename Sets the name of an object and updates all its usages. - + rename_symbol Renames a symbol within the namespace. - + None } description=""/> @@ -741,7 +741,7 @@ Renames a symbol within the namespace. ### replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve_attribute Resolves an attribute access on the namespace. - + TSSymbol | None } description=""/> @@ -790,7 +790,7 @@ Resolves an attribute access on the namespace. ### resolve_import Resolves an import name to a symbol within this namespace. - + TSSymbol | None } description=""/> @@ -798,7 +798,7 @@ Resolves an import name to a symbol within this namespace. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [TSDict](/api-reference/typescript/TSDict), [Expression](/api-reference/core/Expression), [Dict](/api-reference/core/Dict), [Editable](/api-reference/core/Editable) @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSObjectType ] } description=""/> @@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Pair](/api-reference/core/Pair), [HasValue](/api-reference/core/HasValue), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSPair ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -119,7 +119,7 @@ Find all ancestors of the node of the given type. Does not return itself ### convert_to_interface Converts a parameter's inline type definition to an interface. - + None } description=""/> @@ -127,7 +127,7 @@ Converts a parameter's inline type definition to an interface. ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSParameter ] } description=""/> @@ -239,7 +239,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -247,7 +247,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -360,7 +360,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -368,7 +368,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -376,7 +376,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -384,7 +384,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -392,7 +392,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSQueryType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -289,7 +289,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -87,7 +87,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSReadonlyType ] } description=""/> @@ -176,7 +176,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -289,7 +289,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -21,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Modifies the return type annotation of a function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/_deprecated/api-reference/typescript/TSString.mdx b/docs/api-reference/typescript/TSString.mdx similarity index 87% rename from docs/_deprecated/api-reference/typescript/TSString.mdx rename to docs/api-reference/typescript/TSString.mdx index 04bf6644f..589936bfb 100644 --- a/docs/_deprecated/api-reference/typescript/TSString.mdx +++ b/docs/api-reference/typescript/TSString.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSString ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [SwitchCase](/api-reference/core/SwitchCase), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -142,7 +142,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSSwitchCase ] } description=""/> @@ -231,7 +231,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -361,7 +361,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -369,7 +369,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -377,7 +377,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -385,7 +385,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -393,7 +393,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSSwitchStatement ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -301,7 +301,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -179,7 +179,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSSymbol ] } description="The code flag object for tracking purposes"/> @@ -291,7 +291,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -334,7 +334,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -453,7 +453,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -461,7 +461,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -498,7 +498,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -506,7 +506,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -514,7 +514,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TernaryExpression](/api-reference/core/TernaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSTernaryExpression ] } description=""/> @@ -180,7 +180,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -293,7 +293,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -142,7 +142,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSTryCatchStatement ] } description=""/> @@ -231,7 +231,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -361,7 +361,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -369,7 +369,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -377,7 +377,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -385,7 +385,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -393,7 +393,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [TypeAlias](/api-reference/core/TypeAlias), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [HasValue](/api-reference/core/HasValue), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -151,7 +151,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -234,7 +234,7 @@ Find all ancestors of the node of the given type. Does not return itself ### dependencies Returns a list of symbols that this symbol depends on. - + edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. - + CodeFlag[ TSTypeAlias ] } description="The code flag object for tracking purposes"/> @@ -346,7 +346,7 @@ Flags a TypeScript symbol by adding a flag comment and returning a CodeFlag. ### get_attribute Retrieves a specific attribute from a TypeScript type alias by its name. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | TSChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -423,7 +423,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -542,7 +542,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -550,7 +550,7 @@ Check if this node is contained another node of the given class ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -587,7 +587,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -595,7 +595,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -603,7 +603,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSUndefinedType ] } description=""/> @@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -289,7 +289,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [UnionType](/api-reference/core/UnionType), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -91,7 +91,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -99,7 +99,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSUnionType ] } description=""/> @@ -153,7 +153,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -184,7 +184,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -192,7 +192,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -282,7 +282,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -290,7 +290,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -298,7 +298,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -306,7 +306,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,7 +314,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -138,7 +138,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSWhileStatement ] } description=""/> @@ -227,7 +227,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_child_of Checks if this node is a descendant of the given editable instance in the AST. - + bool } description=""/> @@ -357,7 +357,7 @@ Checks if this node is a descendant of the given editable instance in the AST. ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -365,7 +365,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -373,7 +373,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### parent_of_types Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -381,7 +381,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -389,7 +389,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + diff --git a/docs/blog/fixing-import-loops.mdx b/docs/blog/fixing-import-loops.mdx index 2db23159f..5f3fe0ba8 100644 --- a/docs/blog/fixing-import-loops.mdx +++ b/docs/blog/fixing-import-loops.mdx @@ -8,7 +8,7 @@ description: "Identifying and visualizing import loops in the PyTorch codebase" In this post, we will visualize all import loops in the [PyTorch](https://github.com/pytorch/pytorch) codebase, propose a fix for one potentially unstable case, and use Codegen to refactor that fix. -You can find the complete jupyter notebook in our [examples repository](https://github.com/codegen-sh/codegen/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch). +You can find the complete jupyter notebook in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch). Import loops (or circular dependencies) occur when two or more Python modules depend on each other, creating a cycle. For example: @@ -156,4 +156,4 @@ Running this codemod will move all the shared symbols to a separate `utils.py` a Import loops are a common challenge in large Python codebases. Using Codegen, no matter the repo size, you will gain some new insights into your codebase's import structure and be able to perform deterministic manipulations saving developer hours and future runtime errors. -Want to try it yourself? Check out our [complete example](https://github.com/codegen-sh/codegen/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch) of fixing import loops using Codegen. +Want to try it yourself? Check out our [complete example](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch) of fixing import loops using Codegen. diff --git a/docs/_deprecated/building-with-codegen/at-a-glance.mdx b/docs/building-with-codegen/at-a-glance.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/at-a-glance.mdx rename to docs/building-with-codegen/at-a-glance.mdx diff --git a/docs/_deprecated/building-with-codegen/calling-out-to-llms.mdx b/docs/building-with-codegen/calling-out-to-llms.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/calling-out-to-llms.mdx rename to docs/building-with-codegen/calling-out-to-llms.mdx diff --git a/docs/_deprecated/building-with-codegen/class-api.mdx b/docs/building-with-codegen/class-api.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/class-api.mdx rename to docs/building-with-codegen/class-api.mdx diff --git a/docs/_deprecated/building-with-codegen/codebase-visualization.mdx b/docs/building-with-codegen/codebase-visualization.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/codebase-visualization.mdx rename to docs/building-with-codegen/codebase-visualization.mdx diff --git a/docs/_deprecated/building-with-codegen/codegen-with-wsl.mdx b/docs/building-with-codegen/codegen-with-wsl.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/codegen-with-wsl.mdx rename to docs/building-with-codegen/codegen-with-wsl.mdx diff --git a/docs/_deprecated/building-with-codegen/collections.mdx b/docs/building-with-codegen/collections.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/collections.mdx rename to docs/building-with-codegen/collections.mdx diff --git a/docs/_deprecated/building-with-codegen/comments-and-docstrings.mdx b/docs/building-with-codegen/comments-and-docstrings.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/comments-and-docstrings.mdx rename to docs/building-with-codegen/comments-and-docstrings.mdx diff --git a/docs/_deprecated/building-with-codegen/commit-and-reset.mdx b/docs/building-with-codegen/commit-and-reset.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/commit-and-reset.mdx rename to docs/building-with-codegen/commit-and-reset.mdx diff --git a/docs/_deprecated/building-with-codegen/dependencies-and-usages.mdx b/docs/building-with-codegen/dependencies-and-usages.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/dependencies-and-usages.mdx rename to docs/building-with-codegen/dependencies-and-usages.mdx diff --git a/docs/_deprecated/building-with-codegen/dot-codegen.mdx b/docs/building-with-codegen/dot-codegen.mdx similarity index 85% rename from docs/_deprecated/building-with-codegen/dot-codegen.mdx rename to docs/building-with-codegen/dot-codegen.mdx index fdf50d15e..6085af40f 100644 --- a/docs/_deprecated/building-with-codegen/dot-codegen.mdx +++ b/docs/building-with-codegen/dot-codegen.mdx @@ -5,7 +5,7 @@ icon: "folder" iconType: "solid" --- -The `.codegen` directory contains your project's Codegen configuration, codemods, and supporting files. It's automatically created when you run `codegen init`. +The `.codegen` directory contains your project's Codegen configuration, codemods, and supporting files. It's automatically created when you run `gs init`. ## Directory Structure @@ -20,10 +20,10 @@ The `.codegen` directory contains your project's Codegen configuration, codemods ## Initialization -The directory is created and managed using the `codegen init` command: +The directory is created and managed using the `gs init` command: ```bash -codegen init [--fetch-docs] [--repo-name NAME] [--organization-name ORG] +gs init [--fetch-docs] [--repo-name NAME] [--organization-name ORG] ``` @@ -40,7 +40,7 @@ Codegen maintains its own virtual environment in `.codegen/.venv/` to ensure con - Used for running codemods and Jupyter notebooks - Gitignored to avoid committing environment-specific files -The environment is created during `codegen init` and used by commands like `codegen run` and `codegen notebook`. +The environment is created during `gs init` and used by commands like `gs run` and `gs notebook`. To debug codemods, you will need to set the python virtual environment in your IDE to `.codegen/.venv` @@ -78,7 +78,7 @@ Codegen automatically adds appropriate entries to your `.gitignore`: The `codemods/` directory is where your transformation functions live. You can create new codemods using: ```bash -codegen create my-codemod PATH [--description "what it does"] +gs create my-codemod PATH [--description "what it does"] ``` This will: @@ -87,7 +87,7 @@ This will: 3. Set up the necessary imports and decorators -Use `codegen list` to see all codemods in your project. +Use `gs list` to see all codemods in your project. ## Jupyter Integration @@ -115,12 +115,12 @@ After initializing your `.codegen` directory: 1. Create your first codemod: ```bash -codegen create my-codemod . -d "describe what you want to do" +gs create my-codemod . -d "describe what you want to do" ``` 2. Run it: ```bash -codegen run my-codemod --apply-local +gs run my-codemod --apply-local ``` 3. Deploy it for team use: diff --git a/docs/_deprecated/building-with-codegen/editables-and-behaviors.mdx b/docs/building-with-codegen/editables-and-behaviors.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/editables-and-behaviors.mdx rename to docs/building-with-codegen/editables-and-behaviors.mdx diff --git a/docs/_deprecated/building-with-codegen/exports.mdx b/docs/building-with-codegen/exports.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/exports.mdx rename to docs/building-with-codegen/exports.mdx diff --git a/docs/_deprecated/building-with-codegen/external-modules.mdx b/docs/building-with-codegen/external-modules.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/external-modules.mdx rename to docs/building-with-codegen/external-modules.mdx diff --git a/docs/_deprecated/building-with-codegen/files-and-directories.mdx b/docs/building-with-codegen/files-and-directories.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/files-and-directories.mdx rename to docs/building-with-codegen/files-and-directories.mdx diff --git a/docs/_deprecated/building-with-codegen/flagging-symbols.mdx b/docs/building-with-codegen/flagging-symbols.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/flagging-symbols.mdx rename to docs/building-with-codegen/flagging-symbols.mdx diff --git a/docs/_deprecated/building-with-codegen/function-calls-and-callsites.mdx b/docs/building-with-codegen/function-calls-and-callsites.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/function-calls-and-callsites.mdx rename to docs/building-with-codegen/function-calls-and-callsites.mdx diff --git a/docs/_deprecated/building-with-codegen/function-decorator.mdx b/docs/building-with-codegen/function-decorator.mdx similarity index 98% rename from docs/_deprecated/building-with-codegen/function-decorator.mdx rename to docs/building-with-codegen/function-decorator.mdx index cbf95d18b..0010afa66 100644 --- a/docs/_deprecated/building-with-codegen/function-decorator.mdx +++ b/docs/building-with-codegen/function-decorator.mdx @@ -39,7 +39,7 @@ The `function` decorator is part of the codegen SDK CLI and is used to mark func To run a deployed function using the CLI, use the following command: ```bash -codegen run my-function +gs run my-function ``` This command runs the function named `my-function`. diff --git a/docs/_deprecated/building-with-codegen/git-operations.mdx b/docs/building-with-codegen/git-operations.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/git-operations.mdx rename to docs/building-with-codegen/git-operations.mdx diff --git a/docs/_deprecated/building-with-codegen/imports.mdx b/docs/building-with-codegen/imports.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/imports.mdx rename to docs/building-with-codegen/imports.mdx diff --git a/docs/_deprecated/building-with-codegen/inheritable-behaviors.mdx b/docs/building-with-codegen/inheritable-behaviors.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/inheritable-behaviors.mdx rename to docs/building-with-codegen/inheritable-behaviors.mdx diff --git a/docs/_deprecated/building-with-codegen/language-support.mdx b/docs/building-with-codegen/language-support.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/language-support.mdx rename to docs/building-with-codegen/language-support.mdx diff --git a/docs/_deprecated/building-with-codegen/local-variables.mdx b/docs/building-with-codegen/local-variables.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/local-variables.mdx rename to docs/building-with-codegen/local-variables.mdx diff --git a/docs/_deprecated/building-with-codegen/moving-symbols.mdx b/docs/building-with-codegen/moving-symbols.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/moving-symbols.mdx rename to docs/building-with-codegen/moving-symbols.mdx diff --git a/docs/_deprecated/building-with-codegen/parsing-codebases.mdx b/docs/building-with-codegen/parsing-codebases.mdx similarity index 95% rename from docs/_deprecated/building-with-codegen/parsing-codebases.mdx rename to docs/building-with-codegen/parsing-codebases.mdx index 88ea961e9..308fcc04d 100644 --- a/docs/_deprecated/building-with-codegen/parsing-codebases.mdx +++ b/docs/building-with-codegen/parsing-codebases.mdx @@ -83,7 +83,7 @@ codebase = Codebase( - `config`: Toggle specific features like language engines, dependency management, and graph synchronization - `secrets`: API keys and other sensitive information needed by the codebase -For a complete list of available feature flags and configuration options, see the [source code on GitHub](https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/codebase/config.py). +For a complete list of available feature flags and configuration options, see the [source code on GitHub](https://github.com/codegen-sh/graph-sitter/blob/develop/src/codegen/sdk/codebase/config.py). ## Advanced Initialization @@ -117,7 +117,7 @@ codebase = Codebase( ) ``` -For more details on advanced configuration options, see the [source code on GitHub](https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/codebase.py). +For more details on advanced configuration options, see the [source code on GitHub](https://github.com/codegen-sh/graph-sitter/blob/develop/src/codegen/sdk/core/codebase.py). ## Supported Languages diff --git a/docs/_deprecated/building-with-codegen/react-and-jsx.mdx b/docs/building-with-codegen/react-and-jsx.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/react-and-jsx.mdx rename to docs/building-with-codegen/react-and-jsx.mdx diff --git a/docs/_deprecated/building-with-codegen/reducing-conditions.mdx b/docs/building-with-codegen/reducing-conditions.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/reducing-conditions.mdx rename to docs/building-with-codegen/reducing-conditions.mdx diff --git a/docs/_deprecated/building-with-codegen/reusable-codemods.mdx b/docs/building-with-codegen/reusable-codemods.mdx similarity index 91% rename from docs/_deprecated/building-with-codegen/reusable-codemods.mdx rename to docs/building-with-codegen/reusable-codemods.mdx index 024de799a..4e19dea51 100644 --- a/docs/_deprecated/building-with-codegen/reusable-codemods.mdx +++ b/docs/building-with-codegen/reusable-codemods.mdx @@ -12,7 +12,7 @@ Codegen enables you to create reusable code transformations using Python functio The easiest way to create a new codemod is using the CLI [create](/cli/create) command: ```bash -codegen create rename-function . +gs create rename-function . ``` This creates a new codemod in your `.codegen/codemods` directory: @@ -37,7 +37,7 @@ def run(codebase: Codebase): You can use AI to generate an initial implementation by providing a description: ```bash -codegen create rename-function . -d "Rename the getUserData function to fetchUserProfile" +gs create rename-function . -d "Rename the getUserData function to fetchUserProfile" ``` This will: @@ -50,7 +50,7 @@ This will: Once created, run your codemod using: ```bash -codegen run rename-function +gs run rename-function ``` The execution flow: @@ -104,7 +104,7 @@ def run(codebase: Codebase, arguments: RenameArgs): Run it with: ```bash -codegen run rename-function --arguments '{"old_name": "getUserData", "new_name": "fetchUserProfile"}' +gs run rename-function --arguments '{"old_name": "getUserData", "new_name": "fetchUserProfile"}' ``` ## Directory Structure diff --git a/docs/_deprecated/building-with-codegen/semantic-code-search.mdx b/docs/building-with-codegen/semantic-code-search.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/semantic-code-search.mdx rename to docs/building-with-codegen/semantic-code-search.mdx diff --git a/docs/_deprecated/building-with-codegen/statements-and-code-blocks.mdx b/docs/building-with-codegen/statements-and-code-blocks.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/statements-and-code-blocks.mdx rename to docs/building-with-codegen/statements-and-code-blocks.mdx diff --git a/docs/_deprecated/building-with-codegen/symbol-api.mdx b/docs/building-with-codegen/symbol-api.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/symbol-api.mdx rename to docs/building-with-codegen/symbol-api.mdx diff --git a/docs/_deprecated/building-with-codegen/the-editable-api.mdx b/docs/building-with-codegen/the-editable-api.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/the-editable-api.mdx rename to docs/building-with-codegen/the-editable-api.mdx diff --git a/docs/_deprecated/building-with-codegen/traversing-the-call-graph.mdx b/docs/building-with-codegen/traversing-the-call-graph.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/traversing-the-call-graph.mdx rename to docs/building-with-codegen/traversing-the-call-graph.mdx diff --git a/docs/_deprecated/building-with-codegen/type-annotations.mdx b/docs/building-with-codegen/type-annotations.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/type-annotations.mdx rename to docs/building-with-codegen/type-annotations.mdx diff --git a/docs/_deprecated/building-with-codegen/variable-assignments.mdx b/docs/building-with-codegen/variable-assignments.mdx similarity index 100% rename from docs/_deprecated/building-with-codegen/variable-assignments.mdx rename to docs/building-with-codegen/variable-assignments.mdx diff --git a/docs/changelog/changelog.mdx b/docs/changelog/changelog.mdx index 443e43046..4914879cc 100644 --- a/docs/changelog/changelog.mdx +++ b/docs/changelog/changelog.mdx @@ -5,127 +5,127 @@ iconType: "solid" --- -### [Removed GitHub requirement and made 'pink' optional.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.55.1) +### [Removed GitHub requirement and made 'pink' optional.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.55.1) - Removed GitHub as a requirement - Made 'pink' an optional dependency -### [adds setup_commands option and fixes macOS build failures.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.55.0) +### [adds setup_commands option and fixes macOS build failures.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.55.0) - Add setup_commands configuration option - Fix macOS wheel build failures -### [Fixes API client installation and updates documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.54.4) +### [Fixes API client installation and updates documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.54.4) - Fix API client installation - Revamp documentation with new pages and updates -### [Updates sentry-sdk and adds integration documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.54.3) +### [Updates sentry-sdk and adds integration documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.54.3) - Update sentry-sdk to v2.26.1 - Add documentation pages on integrations -### [Improves stability and enhances documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.54.2) +### [Improves stability and enhances documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.54.2) - Upgrade sentry-sdk dependency to improve stability - Enhance documentation with prioritized agent information -### [Fixes undefined field type bug](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.54.1) +### [Fixes undefined field type bug](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.54.1) - Fix undefined field type bug -### [Introduces new API client feature](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.54.0) +### [Introduces new API client feature](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.54.0) - Add API client feature -### [Improves logger stream allocation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.53.0) +### [Improves logger stream allocation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.53.0) - Improve logger stream allocation -### [Updates dependency sentry-sdk.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.31) +### [Updates dependency sentry-sdk.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.31) - Update dependency sentry-sdk to v2.25.1 -### [Improves debugging with git init failure logs.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.30) +### [Improves debugging with git init failure logs.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.30) - Add logs for git initialization failure -### [Fixes codebase initialization issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.29) +### [Fixes codebase initialization issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.29) - Fix issue with codebase initialization -### [Updates OpenAI dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.28) +### [Updates OpenAI dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.28) - Update OpenAI dependency to v1.70.0 -### [Upgrade sentry-sdk dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.27) +### [Upgrade sentry-sdk dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.27) - Upgrade sentry-sdk dependency for better bug tracking -### [Updates openai dependency to the latest version.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.26) +### [Updates openai dependency to the latest version.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.26) - Update dependency openai to version 1.69.0 -### [remove unnecessary transaction in build_graph.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.25) +### [remove unnecessary transaction in build_graph.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.25) - Remove build_graph transaction -### [Documentation update for `codegen create` command.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.24) -- Update documentation for `codegen create` command +### [Documentation update for `gs create` command.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.24) +- Update documentation for `gs create` command -### [Fixes missing module issue in CLI commands.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.23) +### [Fixes missing module issue in CLI commands.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.23) - Fix issue with missing module in CLI commands -### [Fixes issue retrieval in repository client.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.22) +### [Fixes issue retrieval in repository client.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.22) - Fix issue retrieval in repository client -### [Improves stability with sentry-sdk update.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.21) +### [Improves stability with sentry-sdk update.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.21) - Update sentry-sdk to improve stability -### [Removed legacy agent components.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.20) +### [Removed legacy agent components.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.20) - Remove legacy agent components -### [Dependency update for OpenAI.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.19) +### [Dependency update for OpenAI.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.19) - Update OpenAI dependency to version 1.68.2 -### [Updates sentry-sdk dependency and changelog.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.18) +### [Updates sentry-sdk dependency and changelog.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.18) - Update sentry-sdk dependency to v2.24.0 - Update changelog -### [Reverts API change, fixes duplication, updates docs.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.17) +### [Reverts API change, fixes duplication, updates docs.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.17) - Revert changes to API for removing unused symbols - Fix issue with duplicate additional tools - Update API reference documentation @@ -133,87 +133,87 @@ iconType: "solid" -### [Updates OpenAI dependency and PR branch handling.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.16) +### [Updates OpenAI dependency and PR branch handling.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.16) - Update dependency to OpenAI v1.68.0 - Return branch name with PR changes -### [fixes token limit inversion bug.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.15) +### [fixes token limit inversion bug.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.15) - Fix token limit inversion bug -### [Fixes a maximum observation length error.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.14) +### [Fixes a maximum observation length error.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.14) - Fix maximum observation length error -### [Fixes summarization error for images.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.13) +### [Fixes summarization error for images.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.13) - Fix summarization error for images -### [Renames search functionality](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.12) +### [Renames search functionality](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.12) - Renamed search functionality to ripgrep -### [Fixes error, updates docs, adds TypeScript feature.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.11) +### [Fixes error, updates docs, adds TypeScript feature.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.11) - Fix LLM truncation error - Update API reference documentation - Implement Namespace as TypeScript graph node -### [Fixes collection script permissions and newline bug.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.10) +### [Fixes collection script permissions and newline bug.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.10) - Fix permissions on collection script - Workaround for replace not adding newlines -### [Reintroduced schema for tool outputs.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.9) +### [Reintroduced schema for tool outputs.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.9) - Re-add schema for tool outputs -### [Update OpenAI dependency to improve stability.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.8) +### [Update OpenAI dependency to improve stability.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.8) - Update OpenAI dependency to v1.66.5 -### [Improved documentation and fixed log issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.7) +### [Improved documentation and fixed log issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.7) - Updated API reference documentation - Fixed logging for empty repositories and codebase parsing -### [Fixes commit attribution issue](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.6) +### [Fixes commit attribution issue](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.6) - Fix commit attribution issue with codegen-sh -### [Tool update to include default parameter values.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.5) +### [Tool update to include default parameter values.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.5) - Update tool to include default parameter values -### [Fixes parameter reference bug.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.4) +### [Fixes parameter reference bug.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.4) - Fixed parameter reference bug -### [enhances search by filename tool with pagination.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.3) +### [enhances search by filename tool with pagination.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.3) - Update search by filename tool to support pagination -### [Enhances agent and tools, increases token limit.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.2) +### [Enhances agent and tools, increases token limit.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.2) - Increased view file size limit for better usability - Enhanced agent functionality to accept image URLs - Fixed multiple broken links @@ -222,26 +222,26 @@ iconType: "solid" -### [Fixes an error in the search files by name tool.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.1) +### [Fixes an error in the search files by name tool.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.1) - Fix error in search files by name tool -### [New co-author extraction and developer tools](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.52.0) +### [New co-author extraction and developer tools](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.52.0) - Extract co-author information from git configurations - Introduce a global find/replace tool - Add a file-finding tool -### [Updates sentry-sdk and adds instance ID option.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.51.4) +### [Updates sentry-sdk and adds instance ID option.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.51.4) - Update dependency sentry-sdk - Add option to run multiple instance IDs by name -### [Documentation enhancements and dependency update](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.51.3) +### [Documentation enhancements and dependency update](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.51.3) - Update sentry-sdk dependency - Add integrations page to documentation - Fix broken links in documentation @@ -249,12 +249,12 @@ iconType: "solid" -### [Introduces logger interface support.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.51.2) +### [Introduces logger interface support.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.51.2) - Add logger interface support -### [Adds memory truncation feature and directory listing fix.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.51.1) +### [Adds memory truncation feature and directory listing fix.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.51.1) - Fix inefficient directory listing implementation. - Introduce memory truncation feature for conversation history. - Enhance conditionals handling and quality of life improvements. @@ -262,48 +262,48 @@ iconType: "solid" -### [Introduces Pink in codegen with updated API docs.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.51.0) +### [Introduces Pink in codegen with updated API docs.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.51.0) - Updated API reference documentation - Implemented Pink in code generation -### [Fixes draft setting for private repositories.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.50.2) +### [Fixes draft setting for private repositories.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.50.2) - Fix issue with draft setting for private repositories -### [Fixes Relace Edit Tool URL issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.50.1) +### [Fixes Relace Edit Tool URL issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.50.1) - Fix Relace Edit Tool URL -### [Removes JWT authentication feature.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.50.0) +### [Removes JWT authentication feature.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.50.0) - Remove JWT authentication feature -### [Enhancements to error handling and file validation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.6) +### [Enhancements to error handling and file validation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.6) - Improved error handling for file not found errors in RelaceEditTool - Added file validity and existence checks to create_file - Updated API reference -### [Fixes IndexError and file parse issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.5) +### [Fixes IndexError and file parse issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.5) - Fix IndexError when message.content is empty - Resolve issue with disable_file_parse for create_file -### [Increased maximum token limit.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.4) +### [Increased maximum token limit.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.4) - Increased maximum token limit -### [Documentation updates and AI dashboard implementation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.3) +### [Documentation updates and AI dashboard implementation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.3) - Updated API reference documentation - Fixed tests patch - Cleaned up symbol attributions example @@ -312,7 +312,7 @@ iconType: "solid" -### [Updates dependencies and fixes assignment issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.2) +### [Updates dependencies and fixes assignment issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.2) - Update OpenAI dependency to v1.66.3 - Add JWT as an explicit dependency - Improve error handling mechanisms @@ -320,7 +320,7 @@ iconType: "solid" -### [API and bug fixes for import resolution and file handling.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.1) +### [API and bug fixes for import resolution and file handling.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.1) - Updated API reference documentation - Fixed import resolution issues - Ensured correct file directory handling @@ -328,7 +328,7 @@ iconType: "solid" -### [Tool enhancements and compatibility fixes](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.49.0) +### [Tool enhancements and compatibility fixes](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.49.0) - Enhance tool functionality - Fix from_repo compatibility with latest conventions - Add demo for codebase statistics @@ -336,13 +336,13 @@ iconType: "solid" -### [File tool improvements and dependency update](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.9) +### [File tool improvements and dependency update](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.9) - Update dependency openai to v1.66.1 - Improve create file tool functionality -### [Enhancements in documentation and repository retrieval.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.8) +### [Enhancements in documentation and repository retrieval.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.8) - Bug fix: updated openai dependency to v1.66.0 - Added architecture documentation - Enhanced API reference documentation @@ -351,68 +351,68 @@ iconType: "solid" -### [Enhances error handling and adds custom langgraph nodes.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.7) +### [Enhances error handling and adds custom langgraph nodes.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.7) - Improved error handling with enhanced retry policy - Introduced custom langgraph nodes -### [Fixes null body issue in pull request context.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.6) +### [Fixes null body issue in pull request context.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.6) - Fix null body issue in pull request context -### [Adds dataset subsets and improves CLI arguments.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.5) +### [Adds dataset subsets and improves CLI arguments.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.5) - Updated OpenAI dependency - Improved command line arguments - Added subsets of swe-bench lite dataset -### [Fixes import issue and removes outdated Chat Agent.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.4) +### [Fixes import issue and removes outdated Chat Agent.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.4) - Fix search tool import issue - Remove obsolete Chat Agent implementation -### [Fixes git token issue and integrates xAI provider.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.3) +### [Fixes git token issue and integrates xAI provider.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.3) - Fix issue with remote git repo token requirement - Integrate new xAI provider - Update and expand API documentation -### [Fixes PR viewing issue returning 404 error.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.2) +### [Fixes PR viewing issue returning 404 error.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.2) - Fix issue with viewing PR returning 404 -### [Fixes and documentation update with langsmith tagging.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.1) +### [Fixes and documentation update with langsmith tagging.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.1) - Updated API reference - Fixed issue with Codebase.from_repo - Enabled model name tagging for langsmith traces -### [adds view PR checks tool.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.48.0) +### [adds view PR checks tool.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.48.0) - Add view PR checks tool -### [Adds GitHub issues search tool and eval command update.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.47.0) +### [Adds GitHub issues search tool and eval command update.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.47.0) - Adds a new tool for searching GitHub issues - Makes model a parameter for the run eval command -### [Bug fixes and GitHub Webhook functionality improvements.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.46.1) +### [Bug fixes and GitHub Webhook functionality improvements.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.46.1) - Fix invalid file handling bug - Improve GitHub Webhook functionality - Enhance testing and documentation updates -### [Introduces a better search tool and dynamic scaling.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.46.0) +### [Introduces a better search tool and dynamic scaling.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.46.0) - Fix issues with unpacking functionality - Implement dynamic scaling for asyncio requests - Introduce a better search tool @@ -420,12 +420,12 @@ iconType: "solid" -### [Improved bug fixes with updated dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.45.1) +### [Improved bug fixes with updated dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.45.1) - Update dependency to improve bug fixes -### [Improve performance and update documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.45.0) +### [Improve performance and update documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.45.0) - Add runner tooling feature - Speed up directory tree generation - Remove unnecessary tools from agent implementation @@ -433,17 +433,17 @@ iconType: "solid" -### [Fixes a Slack schema error.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.44.4) +### [Fixes a Slack schema error.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.44.4) - Fix Slack schema error -### [Fixes Slack event type handling for rich text.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.44.3) +### [Fixes Slack event type handling for rich text.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.44.3) - Fix Slack event type handling for rich text -### [Fixes and improvements to event handling and codebase.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.44.2) +### [Fixes and improvements to event handling and codebase.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.44.2) - Fix Slack event handling with thread-ts addition - Resolve codebase corruption in file editing - Improve pypath resolution for __init__ files @@ -451,30 +451,30 @@ iconType: "solid" -### [Fixes Slack integration and agent-related issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.44.1) +### [Fixes Slack integration and agent-related issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.44.1) - Fix Slack integration and minor agent issues -### [adds URL replacement feature.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.44.0) +### [adds URL replacement feature.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.44.0) - Add feature for replacing URLs -### [Bug fixes and documentation link corrections.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.43.3) +### [Bug fixes and documentation link corrections.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.43.3) - Fix Slack integration callback - Remove sandbox runner reset feature - Correct broken links in blog posts -### [Documentation updates and bug fix](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.43.2) +### [Documentation updates and bug fix](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.43.2) - Updated API reference documentation - Fixed codeowners property and added regression unit tests -### [Improves test time, evaluation, and documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.43.1) +### [Improves test time, evaluation, and documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.43.1) - Improved test time by modifying validation flow - Enhanced evaluation with new dataset options - Extracted and refactored utility functions for better code organization @@ -483,58 +483,58 @@ iconType: "solid" -### [Add LLM tracing link feature for LangSmith](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.43.0) +### [Add LLM tracing link feature for LangSmith](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.43.0) - Add LLM tracing link feature for LangSmith -### [Fixes compatibility issue by pinning codegen version.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.42.2) +### [Fixes compatibility issue by pinning codegen version.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.42.2) - Pin codegen version to address compatibility issues -### [Documentation updates and unified file import methods.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.42.1) +### [Documentation updates and unified file import methods.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.42.1) - Updated and consolidated API documentation - Unified file import methods for improved usability -### [Enhances local state sync and import parsing.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.42.0) +### [Enhances local state sync and import parsing.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.42.0) - Sync changes to local state before execution - Updated API reference documentation - Improved import parsing in the parser -### [Dependency update and improved documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.8) +### [Dependency update and improved documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.8) - Update OpenAI dependency to v1.65.1 - Convert function names to use underscores - Updated API reference documentation -### [Fixes parameter handling in container management.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.7) +### [Fixes parameter handling in container management.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.7) - Remove extra parameter from container handler -### [update OpenAI dependency to v1.65.0.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.6) +### [update OpenAI dependency to v1.65.0.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.6) - Update dependency to OpenAI v1.65.0 -### [Fix log error issue when commit_sha is None.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.5) +### [Fix log error issue when commit_sha is None.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.5) - Fix log error when commit_sha is None -### [Improves Dockerfile support for various versions.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.4) +### [Improves Dockerfile support for various versions.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.4) - Improve Dockerfile support for published and dev versions -### [Fixes and documentation improvements.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.3) +### [Fixes and documentation improvements.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.3) - Fix Dockerfile-runner inclusion in codegen package - Update language detection testing parameters - Add troubleshooting section to documentation @@ -542,57 +542,57 @@ iconType: "solid" -### [Fixes and improvements for codemods and daemon.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.2) +### [Fixes and improvements for codemods and daemon.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.2) - Fix issue with nested __pycache__ directory in codemods - Improve git configuration and daemon functionality -### [fixes a bug and adds new Codebase support methods.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.1) +### [fixes a bug and adds new Codebase support methods.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.1) - Fix determine programming language bug - Support Codebase.from_string and Codebase.from_files - Updated API reference -### [adds --daemon option and improves dataset access.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.41.0) -- Add --daemon option to codegen run command +### [adds --daemon option and improves dataset access.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.41.0) +- Add --daemon option to gs run command - Improve swebench dataset access -### [Adds Chat Agent and subdirectory support in codegen.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.40.0) +### [Adds Chat Agent and subdirectory support in codegen.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.40.0) - Add functionality to specify subdirectories in `codegen.function` - Introduce a new Chat Agent -### [Custom codebase path setting for code generation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.39.1) +### [Custom codebase path setting for code generation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.39.1) - Allow setting custom codebase path in code generation -### [Lazy Graph Compute Mode and new agent run snapshots.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.39.0) +### [Lazy Graph Compute Mode and new agent run snapshots.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.39.0) - Implement Lazy Graph Compute Mode - Add agent run snapshots feature - Update API reference documentation -### [Adds ripgrep search tool and updates API docs.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.38.0) +### [Adds ripgrep search tool and updates API docs.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.38.0) - Integrate ripgrep in search tool - Update API reference documentation -### [Fixes linting issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.37.1) +### [Fixes linting issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.37.1) - Fix linting issues -### [Custom package resolving and error handling improvements.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.37.0) +### [Custom package resolving and error handling improvements.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.37.0) - Allow custom overrides for package resolving - Add optional sys.path support - Improve error handling with linear tools @@ -601,20 +601,20 @@ iconType: "solid" -### [File Parse Mode disabled by default](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.36.0) +### [File Parse Mode disabled by default](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.36.0) - Disable File Parse Mode feature implemented -### [Replaces edit tool and enhances test configurations.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.35.0) +### [Replaces edit tool and enhances test configurations.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.35.0) - Replace edit tool with a new version - Enhance test configurations and execution -### [Introduces Docker client and major refactor.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.34.0) +### [Introduces Docker client and major refactor.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.34.0) - Introduce Docker client feature - Refactor codebase directory structure - Implement heuristics-based minified file detection @@ -622,14 +622,14 @@ iconType: "solid" -### [Improves GitHub Actions handling and fixes Docker issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.33.1) +### [Improves GitHub Actions handling and fixes Docker issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.33.1) - Improve GitHub Actions token and repo handling - Fix codegen Docker runner issues - Update agent documentation -### [Introduces CodegenApp and enhances codegen capabilities.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.33.0) +### [Introduces CodegenApp and enhances codegen capabilities.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.33.0) - Introduce CodegenApp feature - Add local codegen server daemon - Implement minified file detection using heuristics @@ -637,19 +637,19 @@ iconType: "solid" -### [Improves compatibility with updated dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.32.2) +### [Improves compatibility with updated dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.32.2) - Update dependency for better compatibility -### [Restores default setting for RepoOperator.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.32.1) +### [Restores default setting for RepoOperator.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.32.1) - Restore default setting for RepoOperator to bot_commit=False -### [Langgraph migration and improved dependency instructions.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.32.0) +### [Langgraph migration and improved dependency instructions.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.32.0) - Improved dependency installation instructions - Migrated to Langgraph with Multi-LLM Config - Ignored compiled and minified JavaScript files @@ -657,51 +657,51 @@ iconType: "solid" -### [Fixes GitHub token environment variable key issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.31.1) +### [Fixes GitHub token environment variable key issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.31.1) - Remove secrets_ prefix from GitHub token environment variable key -### [Completes tool upgrades](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.31.0) +### [Completes tool upgrades](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.31.0) - Implement final set of upgrades for tools -### [GitHub action updated and PyGitHub dependency fixed.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.30.1) +### [GitHub action updated and PyGitHub dependency fixed.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.30.1) - Update GitHub action setup to version 5.3 - Fix dependency issue with PyGitHub update to version 2.6.1 -### [Implements tooling fixes.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.30.0) +### [Implements tooling fixes.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.30.0) - Implement tooling fixes -### [introduces benchmarking harness and refactors configuration.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.29.0) +### [introduces benchmarking harness and refactors configuration.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.29.0) - Introduce a benchmarking harness for SWE - Refactor configuration into a dedicated module -### [Improves security by removing secrets prefix.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.28.1) +### [Improves security by removing secrets prefix.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.28.1) - Remove secrets prefix and global .env file. -### [Enhances the codebase agent with additional tools.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.28.0) +### [Enhances the codebase agent with additional tools.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.28.0) - Add extra tools to the codebase agent -### [Improved configuration management and documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.27.0) +### [Improved configuration management and documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.27.0) - Simplify configuration by using a .env file with autoload - Enhance code agent documentation - Add example of using codegen SDK to build integration bots @@ -709,13 +709,13 @@ iconType: "solid" -### [Enhance opt out filter handling.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.26.3) +### [Enhance opt out filter handling.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.26.3) - Introduce should_handle callback for opt out filters -### [Fixes UnicodeDecodeError and enhances file import controls.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.26.2) +### [Fixes UnicodeDecodeError and enhances file import controls.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.26.2) - Fix UnicodeDecodeError when instantiating codebase from repo - Add node_modules to global file ignore list - Ensure files are not imported directly outside specified folder @@ -723,39 +723,39 @@ iconType: "solid" -### [Token requirement relaxed and unpacking feature removed.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.26.1) +### [Token requirement relaxed and unpacking feature removed.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.26.1) - Relax GitHub token requirement on initialization - Remove unpacking assignment feature -### [introduces paginated view file tool.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.26.0) +### [introduces paginated view file tool.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.26.0) - Introduce paginated view file tool -### [Fixes semantic edit tool issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.25.2) +### [Fixes semantic edit tool issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.25.2) - Fix semantic edit tool issues -### [Improves tool output rendering.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.25.1) +### [Improves tool output rendering.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.25.1) - Improve tool output rendering -### [Adds top-level code agent and unicode parsing fix.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.25.0) +### [Adds top-level code agent and unicode parsing fix.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.25.0) - Introduce top-level code agent feature - Fix unicode filename parsing in codebase -### [Fixes filesystem corruption and improves tool observations.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.24.1) +### [Fixes filesystem corruption and improves tool observations.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.24.1) - Upgrade tool observation dataclasses - Fix local filesystem corruption in `get_codebase_session` - Re-enable and fix `verify_output` logic @@ -763,32 +763,32 @@ iconType: "solid" -### [Introduces new RunCodemodTool feature.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.24.0) +### [Introduces new RunCodemodTool feature.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.24.0) - Introduce RunCodemodTool feature -### [Adds replace tool and supports basic file operations.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.23.0) +### [Adds replace tool and supports basic file operations.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.23.0) - Add codebase language replace tool - Allow basic file operations for non-supported languages -### [resolves issues by removing MultiAIProvider.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.22.4) +### [resolves issues by removing MultiAIProvider.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.22.4) - Remove MultiAIProvider to resolve associated issues -### [Introduces a linear webhook example.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.22.3) +### [Introduces a linear webhook example.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.22.3) - Add linear webhook example -### [Enhancements and bug fixes for semantic editing.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.22.2) +### [Enhancements and bug fixes for semantic editing.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.22.2) - Unified operators for consistent behavior - Improved import handling for File/Symbol Index - Enhanced semantic edit functionality with line-specific control @@ -798,20 +798,20 @@ iconType: "solid" -### [Fixes async bug by removing unnecessary reset call.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.22.1) +### [Fixes async bug by removing unnecessary reset call.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.22.1) - Fix async bug by removing codebase reset call -### [introduces new client feature and language detection.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.22.0) +### [introduces new client feature and language detection.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.22.0) - Add server client vs. codebase client feature - Implement git-based codebase language detection -### [Enhances promise handling and updates documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.21.2) +### [Enhances promise handling and updates documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.21.2) - Implemented TSPromise class for better promise handling - Fixed default types setting - Updated external links and documentation @@ -819,45 +819,45 @@ iconType: "solid" -### [Adds initial server and fixes codebase parsing.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.21.1) +### [Adds initial server and fixes codebase parsing.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.21.1) - Add initial server with run and codebase initialization - Fix non-blocking codebase parsing issue -### [Refactor of vector index](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.21.0) +### [Refactor of vector index](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.21.0) - Refactor vector index for improved functionality -### [Update OpenAI dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.20.2) +### [Update OpenAI dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.20.2) - Update OpenAI dependency to v1.63.2 -### [Dependency updates for sentry-sdk and openai.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.20.1) +### [Dependency updates for sentry-sdk and openai.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.20.1) - Update sentry-sdk dependency to v2.22.0 - Update openai dependency to v1.63.1 -### [Introduces a new agent CLI.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.20.0) +### [Introduces a new agent CLI.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.20.0) - Introduce new agent CLI -### [Bug fix for GitHub type handling.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.19.1) +### [Bug fix for GitHub type handling.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.19.1) - Bug fix for GitHub type handling -### [Enable GitHub webhooks and fix tutorial links.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.19.0) +### [Enable GitHub webhooks and fix tutorial links.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.19.0) - Enable GitHub webhooks for better integration - Fix links to examples in tutorials - Apply agent documentation hotfixes @@ -865,41 +865,41 @@ iconType: "solid" -### [Introduces Slack webhook handler and improves documentation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.18.0) +### [Introduces Slack webhook handler and improves documentation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.18.0) - Add Slack webhook handler feature - Improve documentation for research agent -### [Bug fix and new Codebase Analytics Dashboard tutorial](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.17.2) +### [Bug fix and new Codebase Analytics Dashboard tutorial](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.17.2) - Fixes deep code research bug - Adds Codebase Analytics Dashboard tutorial -### [Bug fix with pygithub dependency update.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.17.1) +### [Bug fix with pygithub dependency update.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.17.1) - Update dependency pygithub to v2.6.0 for improved stability -### [Introduces BashCommandTool and improves tool arrangement.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.17.0) +### [Introduces BashCommandTool and improves tool arrangement.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.17.0) - Introduce BashCommandTool feature - Improve tools arrangement -### [Introduces search_linear and create_linear tools.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.16.0) +### [Introduces search_linear and create_linear tools.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.16.0) - Introduce search_linear tool - Introduce create_linear tool -### [Adds linear tools and improves import resolution.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.15.0) +### [Adds linear tools and improves import resolution.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.15.0) - Add linear tools feature - Fix documentation initialization issue - Improve import wildcard resolution @@ -907,13 +907,13 @@ iconType: "solid" -### [Enhanced ergonomic web hook registration](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.5) +### [Enhanced ergonomic web hook registration](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.5) - Enhanced web hook registration for improved ergonomics -### [Adds .json directories support and fixes a bug.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.4) +### [Adds .json directories support and fixes a bug.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.4) - Support for directories with .json files - Fix unauthenticated create bug - Documentation improvements @@ -921,25 +921,25 @@ iconType: "solid" -### [Fixes branch creation issue in create-pr tool.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.3) +### [Fixes branch creation issue in create-pr tool.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.3) - Fix bug in branch creation for the create-pr tool -### [fixes an import bug.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.2) +### [fixes an import bug.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.2) - Fix import bug -### [LSP is now an optional dependency.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.1) +### [LSP is now an optional dependency.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.1) - Make LSP an optional dependency -### [Add LSP and term migration for codegen functionality.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.14.0) +### [Add LSP and term migration for codegen functionality.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.14.0) - Add code generation language server protocol - Migrate terminology from 'programming_language' to 'language' - Improve and update documentation @@ -947,7 +947,7 @@ iconType: "solid" -### [improves link annotation and config commands.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.13.1) +### [improves link annotation and config commands.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.13.1) - Support for directories in link annotation - Add --global flag support in config commands - Enhance repository operator with GitHub property @@ -955,51 +955,51 @@ iconType: "solid" -### [Adds link highlighting and LSP progress reporting.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.13.0) +### [Adds link highlighting and LSP progress reporting.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.13.0) - Add message highlighting for links - Implement LSP progress reporting -### [Removes cache warm-up for improved performance.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.12.3) +### [Removes cache warm-up for improved performance.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.12.3) - Removed cache warm-up -### [Fixes tool arrangement issues.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.12.2) +### [Fixes tool arrangement issues.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.12.2) - Fix tool arrangement issues -### [Fixes list directory tool bugs](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.12.1) +### [Fixes list directory tool bugs](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.12.1) - Fix list directory tool bugs -### [Session validation enhancement.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.12.0) +### [Session validation enhancement.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.12.0) - Session validation added on creation and retrieval -### [Fixes PR tool checkout issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.11.4) +### [Fixes PR tool checkout issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.11.4) - Fix PR tool checkout issue on custom branches -### [Fixes tool handling and improves directory tests.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.11.3) +### [Fixes tool handling and improves directory tests.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.11.3) - Fix tools handling when files are not found - Improve directory tests -### [Fixes and enhancements for PR process and GitHub token usage.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.11.2) +### [Fixes and enhancements for PR process and GitHub token usage.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.11.2) - Fix CodebaseGraph rename issue - Enhance GitHub token usage - Improve pull request creation process @@ -1007,7 +1007,7 @@ iconType: "solid" -### [Adds Neo4j extension and fixes config tests.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.11.1) +### [Adds Neo4j extension and fixes config tests.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.11.1) - Add Neo4j extension for codebase graph export - Fix config tests - Refactor and break up config models @@ -1015,66 +1015,66 @@ iconType: "solid" -### [Global session management and decoupled auth.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.11.0) +### [Global session management and decoupled auth.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.11.0) - Implement global session management - Decouple authentication module -### [add documentation indexing instructions.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.10.4) +### [add documentation indexing instructions.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.10.4) - Add documentation indexing instructions -### [Fixes init command and adds create PR tool.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.10.3) +### [Fixes init command and adds create PR tool.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.10.3) - Fix issue with init command - Add create PR tool for contributors -### [Fixes import path and adds MCP examples.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.10.2) +### [Fixes import path and adds MCP examples.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.10.2) - Fixed import path issue - Added additional MCP examples -### [Fixes a tool issue and enhances code maintainability.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.10.1) +### [Fixes a tool issue and enhances code maintainability.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.10.1) - Fix issue with view_file tool content - Deduplicate codebase for improved maintainability -### [Support for reading local git repo config.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.10.0) +### [Support for reading local git repo config.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.10.0) - Read repository configuration from local git instance -### [fixes a function call issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.9.2) +### [fixes a function call issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.9.2) - Fix function call issue -### [Enhancements to agent implementation.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.9.1) +### [Enhancements to agent implementation.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.9.1) - Improve agent implementation -### [Introducing Codegen-lsp v0 with additional test coverage.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.9.0) +### [Introducing Codegen-lsp v0 with additional test coverage.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.9.0) - Introduce Codegen-lsp v0 feature - Add tests for codebase.create_pr -### [Introduces codeowners interface and enhances codegen.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.8.0) +### [Introduces codeowners interface and enhances codegen.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.8.0) - Update code generation command - Introduce new codeowners interface - Add new examples and improve documentation @@ -1083,20 +1083,20 @@ iconType: "solid" -### [Fixes Slack bot action release-tag input issue.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.6.4) +### [Fixes Slack bot action release-tag input issue.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.6.4) - Fix issue with Slack bot action regarding release-tag input -### [Fixes git tagging and adds a Slack bot example.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.6.3) +### [Fixes git tagging and adds a Slack bot example.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.6.3) - Fix git tagging method for improved accuracy - Add Slack bot example -### [Structural refactor, clearer naming, and new permissions](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.6.2) +### [Structural refactor, clearer naming, and new permissions](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.6.2) - Add content write permission - Refactor file IO for better structure - Rename `CodebaseGraph` to `CodebaseContext` for clarity @@ -1105,7 +1105,7 @@ iconType: "solid" -### [Introduces VectorIndex and supports x86_64 mac.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.6.1) +### [Introduces VectorIndex and supports x86_64 mac.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.6.1) - Add VectorIndex extension and new MCP server feature. - Update Plotly requirement and integrate Plotly.js 3.0.0. - Fix various bugs and improve parsing tests. @@ -1115,26 +1115,26 @@ iconType: "solid" -### [Changes default URLs and removes access token.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.30) +### [Changes default URLs and removes access token.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.30) - Change default URLs - Remove access token from local repo operator -### [Fixes the GithubClient constructor.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.29) +### [Fixes the GithubClient constructor.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.29) - Fix GithubClient constructor -### [Fixes performance issues by disabling uv cache.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.28) +### [Fixes performance issues by disabling uv cache.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.28) - Disable uv cache to resolve performance issues -### [Enhancements and bug fixes including asyncify fix.](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.27) +### [Enhancements and bug fixes including asyncify fix.](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.27) - Fix asyncify return type bug - Add foundations for PR bot static analysis - Generate changelog @@ -1142,13 +1142,13 @@ iconType: "solid" -### [Simplified Slack notifications](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.26) +### [Simplified Slack notifications](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.26) - Simplified Slack notifications by removing description field -### [JSX parsing improvements and workflow optimizations](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.25) +### [JSX parsing improvements and workflow optimizations](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.25) - Fixed JSX prop parsing mechanism - Added semantic release workflow improvements - Fixed handling of empty collections @@ -1158,7 +1158,7 @@ iconType: "solid" -### [Adds Python 3.13 and ARM64 support with feature improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.24) +### [Adds Python 3.13 and ARM64 support with feature improvements](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.24) - Added support for Python 3.13 and ARM64 architecture builds - Added documentation for incremental recomputation - Introduced feature flag for generics support @@ -1168,7 +1168,7 @@ iconType: "solid" -### [Adds symbol flags and improves debugging capabilities](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.23) +### [Adds symbol flags and improves debugging capabilities](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.23) - Added new symbol flag functionality for Python and TypeScript - Introduced duplicate dependencies strategy for file movement - Enhanced debugging capabilities and server health monitoring @@ -1178,7 +1178,7 @@ iconType: "solid" -### [Improves testing and fixes release-related issues](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.22) +### [Improves testing and fixes release-related issues](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.22) - Fixed changelog generation and wheel release issues - Improved test suite with timeouts and standardized move_to_file tests - Enhanced CI/CD pipeline configuration @@ -1186,7 +1186,7 @@ iconType: "solid" -### [Adds ephemeral server and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.21) +### [Adds ephemeral server and improves documentation](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.21) - Added ephemeral server functionality - Improved documentation generation with better type resolution and class docstrings - Enhanced CI/CD workflows and testing infrastructure @@ -1194,7 +1194,7 @@ iconType: "solid" -### [ARM support for Linux](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.19) +### [ARM support for Linux](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.19) - Added ARM support for Linux platforms - Enhanced documentation with architecture docs and improved docstrings - Updated OpenAI dependency to version 1.61.0 @@ -1202,7 +1202,7 @@ iconType: "solid" -### [Adds system prompt generation and improves core functionality](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.18) +### [Adds system prompt generation and improves core functionality](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.18) - Added automatic system prompt generation and gist client integration - Restored namespace module support functionality - Removed dynamic widget component from home page @@ -1212,7 +1212,7 @@ iconType: "solid" -### [Platform and file handling improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.17) +### [Platform and file handling improvements](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.17) - Enhanced file handling with improved TSourceFile return type - Updated platform support capabilities - Added community resources for contributors @@ -1220,7 +1220,7 @@ iconType: "solid" -### [Pydantic v2 migration and documentation updates](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.16) +### [Pydantic v2 migration and documentation updates](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.16) - Update to Pydantic v2 imports and config handling - Documentation and example improvements - Configuration file updates @@ -1228,7 +1228,7 @@ iconType: "solid" -### [Removes auth requirement and fixes path handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.15) +### [Removes auth requirement and fixes path handling](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.15) - Remove authentication requirement for create command - Fix path handling and directory creation - Resolve validator import issues @@ -1236,13 +1236,13 @@ iconType: "solid" -### [Validation system improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.14) +### [Validation system improvements](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.14) - Updated validation system to use BeforeValidator instead of PlainValidator -### [Updates to Pydantic v2 and documentation improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.13) +### [Updates to Pydantic v2 and documentation improvements](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.13) - Updated to Pydantic v2 for span handling - Added documentation for import loops - Improved IDE installation instructions @@ -1250,7 +1250,7 @@ iconType: "solid" -### [Documentation improvements and module resolution fixes](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.12) +### [Documentation improvements and module resolution fixes](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.12) - Enhanced documentation with improved visualization linking and codebase examples - Fixed module resolution issues - Updated VSCode installation guide with Python extensions @@ -1259,14 +1259,14 @@ iconType: "solid" -### [Adds graph disabling feature and fixes command handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.11) +### [Adds graph disabling feature and fixes command handling](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.11) - Add disable_graph feature flag to reduce memory usage and parsing time - Fix bug in create command response handling -### [Adds language detection and improves file handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.10) +### [Adds language detection and improves file handling](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.10) - Added package.json-based repository language detection - Improved file editing capabilities with new raw text edit features - Enhanced documentation with function decorator guide and codebase visualization tutorial @@ -1276,7 +1276,7 @@ iconType: "solid" -### [Documentation improvements and dynamic import support](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.9) +### [Documentation improvements and dynamic import support](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.9) - Improved documentation with new guides and clarifications on file types - Added support for dynamic import detection - Added reset command to CLI @@ -1286,7 +1286,7 @@ iconType: "solid" -### [Fixes branch sync and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.8) +### [Fixes branch sync and improves documentation](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.8) - Fix branch synchronization clone URL issue - Enhance documentation guides - Update development dependencies @@ -1294,7 +1294,7 @@ iconType: "solid" -### [Improves runner functionality and build process](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.7) +### [Improves runner functionality and build process](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.7) - Enhanced runner module functionality and synchronization - Added automatic function imports generation during build process - Updated documentation and README @@ -1302,7 +1302,7 @@ iconType: "solid" -### [New codebase initialization workflow and analytics integration](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.6) +### [New codebase initialization workflow and analytics integration](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.6) - Introduced new codebase initialization workflow - Added PostHog integration and override functionality - Enhanced documentation for session options @@ -1311,8 +1311,8 @@ iconType: "solid" -### [Adds create flag and improves Git repository handling](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.5) -- Added `-d` flag to `codegen create` command +### [Adds create flag and improves Git repository handling](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.5) +- Added `-d` flag to `gs create` command - Fixed Gradio integration issues - Improved automatic base path detection for Git repositories - Enhanced codebase reset functionality to only affect SDK changes @@ -1321,8 +1321,8 @@ iconType: "solid" -### [Adds venv management and TypeScript export support](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.4) -- Added virtual environment creation and persistence for `codegen init` +### [Adds venv management and TypeScript export support](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.4) +- Added virtual environment creation and persistence for `gs init` - Added support for codebase exports in TypeScript projects - Reorganized test structure for better maintainability - Updated graph widget configuration and URLs @@ -1330,18 +1330,18 @@ iconType: "solid" -### [Graph widget and system prompt features added](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.3) +### [Graph widget and system prompt features added](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.3) - Added graph widget visualization feature - Enhanced documentation with improved readability and new guides - Added system prompt functionality -- Fixed core commands: codegen run and create +- Fixed core commands: gs run and create - Various internal code cleanup and reorganization -### [Adds notebook functionality and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.2) -- Added new codegen notebook functionality +### [Adds notebook functionality and improves documentation](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.2) +- Added new gs notebook functionality - Fixed several documentation rendering issues and broken links - Added function call parameter documentation helpers - Fixed various type annotations and AST-related bugs @@ -1350,7 +1350,7 @@ iconType: "solid" -### [Adds remote codebase support and improves documentation](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.1) +### [Adds remote codebase support and improves documentation](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.1) - Added support for fetching remote codebases - Fixed documentation and GitHub link parsing issues - Improved test organization and coverage @@ -1360,7 +1360,7 @@ iconType: "solid" -### [Major documentation overhaul and API improvements](https://github.com/codegen-sh/codegen-sdk/releases/tag/v0.5.0) +### [Major documentation overhaul and API improvements](https://github.com/codegen-sh/graph-sitter/releases/tag/v0.5.0) - New documentation system with MDX support and interactive codemod widget - Simplified API with improved module organization and naming - Added Codebase and CLI functionality for easier code manipulation diff --git a/docs/_deprecated/cli/about.mdx b/docs/cli/about.mdx similarity index 94% rename from docs/_deprecated/cli/about.mdx rename to docs/cli/about.mdx index a70e525b2..6af9e5115 100644 --- a/docs/_deprecated/cli/about.mdx +++ b/docs/cli/about.mdx @@ -21,13 +21,13 @@ The graph_sitter.cli helps you: 1. **Initialize Codegen** in your repository: ```bash -codegen init +gs init ``` 2. **Create your first codemod**: ```bash -codegen create my-codemod --description "What you want to accomplish" +gs create my-codemod --description "What you want to accomplish" ``` The `--description` flag enables AI assistance to help generate your codemod. Be as specific as possible about what you want to achieve. diff --git a/docs/_deprecated/cli/create.mdx b/docs/cli/create.mdx similarity index 86% rename from docs/_deprecated/cli/create.mdx rename to docs/cli/create.mdx index 9abd0502e..4eaf42798 100644 --- a/docs/_deprecated/cli/create.mdx +++ b/docs/cli/create.mdx @@ -8,13 +8,13 @@ iconType: "solid" The `create` command generates a new codemod function with the necessary boilerplate. ```bash -codegen create rename-function . +gs create rename-function . ``` ## Usage ```bash -codegen create NAME PATH [OPTIONS] +gs create NAME PATH [OPTIONS] ``` ## Arguments @@ -28,7 +28,7 @@ codegen create NAME PATH [OPTIONS] ## Generated Files -When you run `codegen create rename-function .`, it creates: +When you run `gs create rename-function .`, it creates: ``` .codegen/ @@ -64,19 +64,19 @@ if __name__ == "__main__": Create a basic codemod: ```bash -codegen create rename-function . +gs create rename-function . ``` Create with an AI-powered implementation: ```bash -codegen create rename-function . -d "Rename the getUserData function to fetchUserProfile" +gs create rename-function . -d "Rename the getUserData function to fetchUserProfile" ``` ## Next Steps After creating a codemod: 1. Edit the implementation in the generated .py file -2. Test it with `codegen run rename-function` +2. Test it with `gs run rename-function` 3. Deploy it for team use with `codegen deploy rename-function` ## Common Issues diff --git a/docs/_deprecated/cli/expert.mdx b/docs/cli/expert.mdx similarity index 94% rename from docs/_deprecated/cli/expert.mdx rename to docs/cli/expert.mdx index c6ecc5e91..0f7bf120e 100644 --- a/docs/_deprecated/cli/expert.mdx +++ b/docs/cli/expert.mdx @@ -56,6 +56,6 @@ The expert has deep knowledge of Codegen's internals and common transformation p ## Related Commands -- `codegen create`: Create new codemods with AI assistance -- `codegen run`: Execute your codemods +- `gs create`: Create new codemods with AI assistance +- `gs run`: Execute your codemods - `codegen docs-search`: Search documentation and examples diff --git a/docs/_deprecated/cli/init.mdx b/docs/cli/init.mdx similarity index 83% rename from docs/_deprecated/cli/init.mdx rename to docs/cli/init.mdx index 5c37df415..b4c0c2a9c 100644 --- a/docs/_deprecated/cli/init.mdx +++ b/docs/cli/init.mdx @@ -10,7 +10,7 @@ The `init` command sets up Codegen in your repository, creating necessary config ## Usage ```bash -codegen init [OPTIONS] +gs init [OPTIONS] ``` ## Options @@ -20,13 +20,13 @@ codegen init [OPTIONS] ## Directory Structure -When you run `init`, Codegen creates a `.codegen` directory in your repository with the following structure: +When you run `init`, gs creates a `.codegen` directory in your repository with the following structure: ``` .codegen/ ā”œā”€ā”€ config.toml # Configuration file with repo and org info ā”œā”€ā”€ codemods/ # Your codemods live here -│ └── my_codemod.py # Created via `codegen create my-codemod` +│ └── my_codemod.py # Created via `gs create my-codemod` ā”œā”€ā”€ docs/ # Local documentation for offline access │ ā”œā”€ā”€ api/ │ ā”œā”€ā”€ examples/ @@ -47,7 +47,7 @@ This setup allows you to: ## Recommended Structure -We recommend keeping your Codegen codemods in the `.codegen/codemods/` directory (this is the default when using `codegen create`). This: +We recommend keeping your Codegen codemods in the `.codegen/codemods/` directory (this is the default when using `gs create`). This: - Keeps transformation code separate from your application code - Makes it easy to find and manage all your codemods @@ -68,7 +68,7 @@ The command must be run from within a git repository. If you're not in one, you' ```bash git init git remote add origin -codegen init +gs init ``` ## Examples @@ -76,13 +76,13 @@ codegen init Initialize with default settings (uses git repo info): ```bash -codegen init +gs init ``` Initialize with custom organization and repo: ```bash -codegen init --organization-name "my-org" --repo-name "my-project" +gs init --organization-name "my-org" --repo-name "my-project" ``` ## Next Steps @@ -92,7 +92,7 @@ After initializing: 1. Create your first codemod: ```bash -codegen create my-function . -d "describe what you want to do" +gs create my-function . -d "describe what you want to do" ``` Note: The second parameter (`.`) specifies the path where the codemod should be created. This is required. @@ -100,7 +100,7 @@ Note: The second parameter (`.`) specifies the path where the codemod should be 2. Run it: ```bash -codegen run my-function --apply-local +gs run my-function --apply-local ``` ## Updating @@ -108,7 +108,7 @@ codegen run my-function --apply-local You can run `init` again to update your local documentation and configuration: ```bash -codegen init +gs init ``` This will refresh the `.codegen` directory while preserving your existing configuration. diff --git a/docs/_deprecated/cli/login.mdx b/docs/cli/login.mdx similarity index 100% rename from docs/_deprecated/cli/login.mdx rename to docs/cli/login.mdx diff --git a/docs/_deprecated/cli/notebook.mdx b/docs/cli/notebook.mdx similarity index 89% rename from docs/_deprecated/cli/notebook.mdx rename to docs/cli/notebook.mdx index e1b298ad4..8e6478c40 100644 --- a/docs/_deprecated/cli/notebook.mdx +++ b/docs/cli/notebook.mdx @@ -11,7 +11,7 @@ The `notebook` command launches a Jupyter Lab instance with a pre-configured not ## Usage ```bash -codegen notebook [--background] +gs notebook [--background] ``` ### Options @@ -45,7 +45,7 @@ codebase = Codebase('../../') ## Directory Structure -After running `codegen notebook`, your repository will have this structure: +After running `gs notebook`, your repository will have this structure: ``` .codegen/ @@ -59,13 +59,13 @@ After running `codegen notebook`, your repository will have this structure: ```bash # Run Jupyter in the foreground (default) -codegen notebook +gs notebook # Run Jupyter in the background -codegen notebook --background +gs notebook --background # Initialize a new repository and launch notebook -codegen init && codegen notebook +gs init && gs notebook ``` diff --git a/docs/_deprecated/cli/reset.mdx b/docs/cli/reset.mdx similarity index 89% rename from docs/_deprecated/cli/reset.mdx rename to docs/cli/reset.mdx index 756bdfb40..26c84b4fb 100644 --- a/docs/_deprecated/cli/reset.mdx +++ b/docs/cli/reset.mdx @@ -10,12 +10,12 @@ The `reset` command performs a hard reset of your git repository while carefully ## Usage ```bash -codegen reset +gs reset ``` ## What it Does -When you run `codegen reset`, it: +When you run `gs reset`, it: 1. Backs up all files in `.codegen` directory, preserving their content and staged/unstaged status 2. Performs a hard reset (`git reset --hard HEAD`) on the repository @@ -34,10 +34,10 @@ This is more sophisticated than `git checkout .` as it: Reset after testing a codemod: ```bash # Run your codemod -codegen run organize-imports +gs run organize-imports # If the changes aren't what you wanted -codegen reset # Reverts changes but keeps your codemod implementation +gs reset # Reverts changes but keeps your codemod implementation ``` diff --git a/docs/_deprecated/cli/run.mdx b/docs/cli/run.mdx similarity index 84% rename from docs/_deprecated/cli/run.mdx rename to docs/cli/run.mdx index 3adce12a4..636017e1d 100644 --- a/docs/_deprecated/cli/run.mdx +++ b/docs/cli/run.mdx @@ -8,13 +8,13 @@ iconType: "solid" The `run` command executes a codemod against your local codebase, showing you the changes and applying them to your filesystem. ```bash -codegen run rename-function +gs run rename-function ``` ## Usage ```bash -codegen run LABEL [OPTIONS] +gs run LABEL [OPTIONS] ``` ## Arguments @@ -30,17 +30,17 @@ codegen run LABEL [OPTIONS] Run a codemod: ```bash -codegen run rename-function +gs run rename-function ``` Run with a diff preview limited to 50 lines: ```bash -codegen run rename-function --diff-preview 50 +gs run rename-function --diff-preview 50 ``` Run with arguments (for codemods that require them): ```bash -codegen run rename-function --arguments '{"old_name": "getUserData", "new_name": "fetchUserProfile"}' +gs run rename-function --arguments '{"old_name": "getUserData", "new_name": "fetchUserProfile"}' ``` ## Output diff --git a/docs/_deprecated/cli/update.mdx b/docs/cli/update.mdx similarity index 100% rename from docs/_deprecated/cli/update.mdx rename to docs/cli/update.mdx diff --git a/docs/docs.json b/docs/docs.json index 8333377c8..9b6977c90 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -83,7 +83,7 @@ "primary": { "type": "button", "label": "GitHub", - "href": "https://github.com/codegen-sh/codegen-sdk" + "href": "https://github.com/codegen-sh/graph-sitter" } }, "seo": { diff --git a/docs/gen/capabilities.mdx b/docs/gen/capabilities.mdx deleted file mode 100644 index e936e8eda..000000000 --- a/docs/gen/capabilities.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: "Capabilities" -icon: "gear" ---- - -Codegen is built on an [open-source library](/introduction/overview) for code manipulation. - -It combines "tools" for code editing with powerful integrations, including Github, Linear and Slack. - - - Learn more about our open source [code agent implementation](/tutorials/build-code-agent) - - -## Communication Tools - -- **SlackSendMessageTool**: Allows Codegen to send messages in Slack channels and threads, providing responses to your queries and sharing information with your team. - -## GitHub Integration Tools - -Codegen includes a comprehensive set of GitHub tools: - -- **GithubCheckoutPRTool**: Checks out pull requests to your local environment for review and testing. - -- **GithubCreatePRTool**: Creates new pull requests from your current branch, including title, description, and target branch. - -- **GithubCreatePRCommentTool**: Adds comments to pull requests for feedback and team communication. - -- **GithubCreatePRReviewCommentTool**: Provides inline comments on specific code changes within pull requests. - -- **GithubEditPRTool**: Modifies existing pull requests, including updating titles, descriptions, and other metadata. - -- **GithubSearchIssuesTool**: Searches for GitHub issues based on various criteria like status, assignee, or labels. - -- **GithubViewPRTool**: Retrieves and displays information about specific pull requests. - -- **GithubViewPRCheckTool**: Checks the status of CI/CD and other automated checks on pull requests. - -- **GithubViewCommitHistoryTool**: Shows the commit history of a repository or specific branch. - -- **GithubViewCommitTool**: Displays details about specific commits, including changes made. - -## Linear Integration Tools (Optional) - -For teams using Linear for project management, Codegen offers: - -- **LinearGetIssueTool**: Retrieves details about specific Linear issues. - -- **LinearGetIssueCommentsTool**: Fetches comments on Linear issues for context and history. - -- **LinearCommentOnIssueTool**: Adds comments to Linear issues for team communication. - -- **LinearSearchIssuesTool**: Searches for Linear issues based on various criteria. - -- **LinearCreateIssueTool**: Creates new issues in Linear with appropriate metadata. - -- **LinearGetTeamsTool**: Retrieves information about teams in your Linear organization. - -## How Codegen Uses These Tools - -Codegen's brain (powered by Claude 3.7 Sonnet) intelligently selects and combines these tools to: - -1. Understand your requests through natural language in Slack -2. Determine the most appropriate tools to fulfill your request -3. Execute the necessary actions across GitHub, Linear, and your codebase -4. Provide clear, helpful responses back in Slack - -This seamless integration allows you to manage your entire development workflow through simple conversations, without having to switch between different platforms and interfaces. \ No newline at end of file diff --git a/docs/gen/faq.mdx b/docs/gen/faq.mdx deleted file mode 100644 index 2a34b0435..000000000 --- a/docs/gen/faq.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Frequently Asked Questions" -sidebarTitle: "FAQ" -icon: "square-question" -iconType: "solid" ---- - - - - Claude 3.7. Our code agent is roughly comparable with Claude Code. - - - Yes! For now. Get it while it's hot. - - - Codegen stores this data in their private cloud. We are SOC-2 compliant. [Learn more](/introduction/about) - - \ No newline at end of file diff --git a/docs/gen/integrations.mdx b/docs/gen/integrations.mdx deleted file mode 100644 index a1d94c500..000000000 --- a/docs/gen/integrations.mdx +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: 'Integrations' -description: 'Integrate Codegen with your favorite tools and platforms' -icon: 'puzzle-piece' ---- - - - Get started with Codegen integrations by installing the CLI - - -## Available Integrations - -### GitHub - -Codegen integrates seamlessly with GitHub, allowing you to: -- Run automated code reviews -- Manage pull requests -- Analyze codebases -- Automate code modifications at scale - -### Slack - -Connect Codegen with Slack to: -- Receive notifications about code changes -- Run code analysis directly from Slack -- Get instant feedback on pull requests -- Collaborate with your team on code reviews - -### Linear - -Our Linear integration enables you to: -- Link code changes to issues -- Automatically update ticket status -- Track code modifications across projects -- Streamline your development workflow - -## Coming Soon - -We're actively working on integrations with: -- Sentry -- Vercel -- Modal -- And more! - -Stay tuned for updates or [join our community](/introduction/community) to request new integrations. diff --git a/docs/gen/introduction.mdx b/docs/gen/introduction.mdx deleted file mode 100644 index a5d953af0..000000000 --- a/docs/gen/introduction.mdx +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: "Codegen: AI Development Assistant" -sidebarTitle: "Introduction" -icon: "lightbulb" ---- - -Codegen is an intelligent code agent powered that seamlessly integrates with Slack, Github and Linear. - - - - - - - Explore our [Capabilities](/gen/capabilities) page to learn more about - Codegen's full feature set and available tools! - - - -# Installation - -[Log in with GitHub](https://codegen.sh/install) to install Codegen and set up integrations. - - - Install codegen via OAuth with Github, Slack and Linear - - -# Common Queries - -> *Edit repo X so that the user auth flow uses JWT* -Modify the authentication flow in a specified repository to use JSON Web Tokens. This ensures secure and stateless authentication. - -> *Show me the recent activity on my repo X* -Display the latest commits, pull requests, and other activities in a specified repository. This helps you stay updated with ongoing changes. - -> *Can you figure out why my tests are failing on `main`?* -Analyze the test failures on the main branch to identify potential issues. This assists in maintaining code quality and stability. - -> *Can you review my PR?* -Perform a code review on a specified pull request, providing feedback and suggestions. This ensures code quality and adherence to best practices. - -> *Do we have any tickets about Y?* -Search for tickets related to a specific topic or issue. This helps in tracking and managing tasks effectively. - diff --git a/docs/graph-sitter/about.mdx b/docs/graph-sitter/about.mdx index d7ffe80a1..2352d4fee 100644 --- a/docs/graph-sitter/about.mdx +++ b/docs/graph-sitter/about.mdx @@ -37,7 +37,7 @@ Based in San Francisco, we're a team of engineers and researchers passionate abo ## Open Source -We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/codegen-sdk), is freely available and open to contributions from the community. +We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/graph-sitter), is freely available and open to contributions from the community. ## Join Us diff --git a/docs/graph-sitter/community.mdx b/docs/graph-sitter/community.mdx index ed02a4276..b240f07d9 100644 --- a/docs/graph-sitter/community.mdx +++ b/docs/graph-sitter/community.mdx @@ -40,7 +40,7 @@ Join the growing Codegen community! We're excited to have you be part of our jou We welcome contributions of all kinds! Whether you're fixing a typo in documentation, reporting a bug, or implementing a new feature, we appreciate your help in making Codegen better. -Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/develop/CONTRIBUTING.md) on GitHub to learn how to: +Check out our [Contributing Guide](https://github.com/codegen-sh/graph-sitter/blob/develop/CONTRIBUTING.md) on GitHub to learn how to: - Set up your development environment - Submit pull requests diff --git a/docs/graph-sitter/faq.mdx b/docs/graph-sitter/faq.mdx index d7f3abfba..f72e4c95f 100644 --- a/docs/graph-sitter/faq.mdx +++ b/docs/graph-sitter/faq.mdx @@ -41,18 +41,18 @@ iconType: "solid" icon="hand-holding-heart" > Start by trying out Codegen, joining our [Slack community](https://community.codegen.com), and looking for - issues labeled "good first issue" on [GitHub](https://github.com/codegen-sh/codegen-sdk). We welcome contributions to + issues labeled "good first issue" on [GitHub](https://github.com/codegen-sh/graph-sitter). We welcome contributions to documentation, examples, and code improvements. - Yes, Codegen is [open source](https://github.com/codegen-sh/codegen-sdk) and free to use under the [Apache 2.0 - license](https://github.com/codegen-sh/codegen-sdk?tab=Apache-2.0-1-ov-file). + Yes, Codegen is [open source](https://github.com/codegen-sh/graph-sitter) and free to use under the [Apache 2.0 + license](https://github.com/codegen-sh/graph-sitter?tab=Apache-2.0-1-ov-file). You can use it for both personal and commercial projects. The best places to get help are: 1. Our community [Slack channel](https://community.codegen.com) - 2. [GitHub issues](https://github.com/codegen-sh/codegen-sdk) for bug reports + 2. [GitHub issues](https://github.com/codegen-sh/graph-sitter) for bug reports 3. Reach out to us on [Twitter](https://x.com/codegen) diff --git a/docs/graph-sitter/getting-started.mdx b/docs/graph-sitter/getting-started.mdx index a87fc47d8..321f740e0 100644 --- a/docs/graph-sitter/getting-started.mdx +++ b/docs/graph-sitter/getting-started.mdx @@ -17,11 +17,11 @@ uv tool install codegen ## Quick Start with Jupyter -The [codegen notebook](/cli/notebook) command creates a virtual environment and opens a Jupyter notebook for quick prototyping. This is often the fastest way to get up and running. +The [gs notebook](/cli/notebook) command creates a virtual environment and opens a Jupyter notebook for quick prototyping. This is often the fastest way to get up and running. ```bash # Launch Jupyter with a demo notebook -codegen notebook --demo +gs notebook --demo ``` diff --git a/docs/graph-sitter/how-it-works.mdx b/docs/graph-sitter/how-it-works.mdx index d891a9c08..0cb0330cd 100644 --- a/docs/graph-sitter/how-it-works.mdx +++ b/docs/graph-sitter/how-it-works.mdx @@ -16,7 +16,7 @@ Codegen performs advanced static analysis to build a rich graph representation o Codegen is open source. Check out the [source - code](https://github.com/codegen-sh/codegen-sdk) to learn more! + code](https://github.com/codegen-sh/graph-sitter) to learn more! ## The Codebase Graph diff --git a/docs/graph-sitter/installation.mdx b/docs/graph-sitter/installation.mdx deleted file mode 100644 index 41188c64b..000000000 --- a/docs/graph-sitter/installation.mdx +++ /dev/null @@ -1,125 +0,0 @@ ---- -title: "Installation" -sidebarTitle: "Installation" -icon: "download" -iconType: "solid" ---- - -Install and set up Codegen in your development environment. - -#### We currently support: -- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+) -- macOS and Linux - - macOS is supported - - Linux is supported on x86_64 and aarch64 with glibc 2.34+ - - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details. -- Python, Typescript, Javascript and React codebases - -## Prerequisites - -We recommend using [uv](https://github.com/astral-sh/uv) for installation. If you haven't installed `uv` yet: -```bash -curl -LsSf https://astral.sh/uv/install.sh | sh -``` - -## Installing Codegen - -```bash -uv tool install codegen --python 3.13 -``` - - - -This makes the `codegen` command available globally in your terminal, while keeping its dependencies isolated. - - -## Quick Start - -Let's walk through a minimal example of using Codegen in a project: - -1. Navigate to your repository: - ```bash - cd path/to/your/project - ``` - -2. Initialize Codegen in your project with [codegen init](/cli/init): - ```bash - codegen init - ``` - - This creates a `.codegen/` directory with: - ```bash - .codegen/ - ā”œā”€ā”€ .venv/ # Python virtual environment (gitignored) - ā”œā”€ā”€ config.toml # Project configuration - ā”œā”€ā”€ codemods/ # Your codemod implementations - ā”œā”€ā”€ jupyter/ # Jupyter notebooks for exploration - └── codegen-system-prompt.txt # AI system prompt - ``` - -3. Create your first codemod with [codegen create](/cli/create): - ```bash - codegen create organize-imports \ - -d "Sort and organize imports according to PEP8" - ``` - - The `-d` flag in `codegen create` generates an AI-powered implementation. This requires a Github account registered on [codegen.sh](https://codegen.sh) - - - - -4. Run your codemod with [codegen run](/cli/run): - ```bash - codegen run organize-imports - ``` - -5. Reset any filesystem changes (excluding `.codegen/*`) with [codegen reset](/cli/reset): - ```bash - codegen reset - ``` - -## Troubleshooting - -Having issues? Here are some common problems and their solutions: - -- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`. -- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`. -- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`. - - -For more help, join our [community Slack](/introduction/community) or check the [FAQ](/introduction/faq). - - -## Next Steps - - - - Learn how to use Codegen effectively in VSCode, Cursor, and other IDEs. - - - Follow step-by-step tutorials for common code transformation tasks. - - - Leverage AI assistants like Copilot, Cursor and Devin - - - Learn more about building with Codegen - - - diff --git a/docs/graph-sitter/overview.mdx b/docs/graph-sitter/overview.mdx index 4a0011d6c..a6c6f7b96 100644 --- a/docs/graph-sitter/overview.mdx +++ b/docs/graph-sitter/overview.mdx @@ -5,7 +5,7 @@ icon: "code" iconType: "solid" --- -[Codegen](https://github.com/codegen-sh/codegen-sdk) is a python library for manipulating codebases. +[Codegen](https://github.com/codegen-sh/graph-sitter) is a python library for manipulating codebases. It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/). @@ -64,13 +64,6 @@ For further & more in depth installation instructions, see the [installation gui Codegen's simple yet powerful APIs enable a range of applications, including: - - Create an intelligent agent that can analyze and manipulate your codebase using natural language. - - Download System Prompt - - -Learn about leveraging this in IDE chat assistants like Cursor [here](/introduction/ide-usage#iterating-with-chat-assistants) - -## Generating System Prompts - -The [graph_sitter.cli](/cli/about) provides commands to generate `.md` files that can be fed to any AI assistant for more accurate and contextual help. - -When you create a new codemod via [codegen create](/cli/create): - -```bash -codegen create delete-dead-imports . --description "Delete unused imports" -``` - -Codegen automatically generates an optimized ["system prompt"](https://news.ycombinator.com/item?id=37880023) that includes: - -- An introduction to Codegen -- Codegen API documentation -- Examples of relevant transformations - -You can find this generated prompt in the `.codegen/prompts/-system-prompt.md` file. - - - All contents of the `.codegen/prompts` directory are by default ignored the - `.gitignore` file. after running [codegen init](/cli/init) - - -This `.md` file can be used with any AI assistant (Claude, GPT-4, etc.) to get more accurate and contextual help. - -## Example Workflow - - - - Use the [create command](/cli/create) with a detailed description of what you want to accomplish: - ```bash - codegen create modernize-components . --description "Convert class components to functional components with hooks" - ``` - - - Check the AI context that Codegen generated for your transformation: ```bash - cat codegen-sh/codemods/modernize-components/prompt.md ``` - - - - Reference your codemod when asking questions to get contextual help: ``` - @codegen-sh/codemods/modernize-components How should I handle - componentDidMount? ``` - - - - The AI will understand you're working on React modernization and provide relevant suggestions about using useEffect hooks and other modern React patterns. - - - -## Copilot, Cursor and Windsurf (IDEs) - -When using IDE chat assistants, you can leverage Codegen's context by mentioning your codemod in composer mode: - -```bash -@.codegen/codemods/upgrade-react18 @.codegen/prompts/system-prompt.md -``` - -This will ensure that the IDE's native chat model is aware of the APIs and common patterns for Codegen. - -## Devin, OpenHands and Semi-autonomous Code Agents - -Coming soon! diff --git a/docs/introduction/about.mdx b/docs/introduction/about.mdx index f6a065a30..41b840c41 100644 --- a/docs/introduction/about.mdx +++ b/docs/introduction/about.mdx @@ -32,7 +32,7 @@ Based in San Francisco, we're a team of engineers and researchers passionate abo ## Open Source -We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/codegen-sdk), is freely available and open to contributions from the community. +We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/graph-sitter), is freely available and open to contributions from the community. ## Join Us diff --git a/docs/graph-sitter/advanced-settings.mdx b/docs/introduction/advanced-settings.mdx similarity index 97% rename from docs/graph-sitter/advanced-settings.mdx rename to docs/introduction/advanced-settings.mdx index 0a6e86c91..a7e576c1c 100644 --- a/docs/graph-sitter/advanced-settings.mdx +++ b/docs/introduction/advanced-settings.mdx @@ -18,7 +18,7 @@ If you need help, please visit our [community](/introduction/community). -These configuration options are defined in [src/codegen/configs/models/codebase.py](https://github.com/codegen-sh/codegen/blob/develop/src/codegen/configs/models/codebase.py). +These configuration options are defined in [src/codegen/configs/models/codebase.py](https://github.com/codegen-sh/graph-sitter/blob/develop/src/codegen/configs/models/codebase.py). # Usage @@ -136,7 +136,7 @@ Method usage resolution could be disabled for a marginal performance boost. Howe Enables or disables graph sync during `codebase.commit`. -Implementation-specific details on sync graph can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/6.%20incremental-computation/C.%20Graph%20Recomputation.md). +Implementation-specific details on sync graph can be found [here](https://github.com/codegen-sh/graph-sitter/blob/develop/architecture/6.%20incremental-computation/C.%20Graph%20Recomputation.md). This section won't go into the specific details of sync graph, but the general idea is that enabling sync graph will update the Codebase object to whatever new changes were made. @@ -340,7 +340,7 @@ Instead, just install `node_modules` as normal (either through `npm`, `pnpm`, or Enables Codegen's internal dependency installer for TypeScript. This will modify `package.json` and install the bare minimum set of installable dependencies. -More documentation on TypeScript dependency manager can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/external/dependency-manager.md) +More documentation on TypeScript dependency manager can be found [here](https://github.com/codegen-sh/graph-sitter/blob/develop/architecture/external/dependency-manager.md) ## Flag: `ts_language_engine` diff --git a/docs/introduction/api.mdx b/docs/introduction/api.mdx index 09e50afa1..566713f43 100644 --- a/docs/introduction/api.mdx +++ b/docs/introduction/api.mdx @@ -5,7 +5,7 @@ icon: "code" iconType: "solid" --- -The [Codegen SDK](https://github.com/codegen-sh/codegen-sdk) enables developers to programmatically interact with [Codegen](https://codegen.com) SWE agents via API. +The [Codegen SDK](https://github.com/codegen-sh/graph-sitter) enables developers to programmatically interact with [Codegen](https://codegen.com) SWE agents via API. Go to [developer settings](https://codegen.sh/token) to generate an API token diff --git a/docs/introduction/community.mdx b/docs/introduction/community.mdx index ed02a4276..b240f07d9 100644 --- a/docs/introduction/community.mdx +++ b/docs/introduction/community.mdx @@ -40,7 +40,7 @@ Join the growing Codegen community! We're excited to have you be part of our jou We welcome contributions of all kinds! Whether you're fixing a typo in documentation, reporting a bug, or implementing a new feature, we appreciate your help in making Codegen better. -Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/develop/CONTRIBUTING.md) on GitHub to learn how to: +Check out our [Contributing Guide](https://github.com/codegen-sh/graph-sitter/blob/develop/CONTRIBUTING.md) on GitHub to learn how to: - Set up your development environment - Submit pull requests diff --git a/docs/introduction/faq.mdx b/docs/introduction/faq.mdx index a2accd1de..f72e4c95f 100644 --- a/docs/introduction/faq.mdx +++ b/docs/introduction/faq.mdx @@ -7,50 +7,52 @@ iconType: "solid" - The Codegen AI agent leverages modern large language models (LLMs) for code - understanding and generation. This means it can generally handle tasks - involving any programming language, configuration format (like JSON, YAML), - documentation (like Markdown), or other text-based files that current LLMs - are proficient with. If you have specific needs or find limitations with a - particular language or format, please let us know! + Codegen currently parses two languages: + - [Python](/api-reference/python) + - [TypeScript](/api-reference/typescript) + + We're actively working on expanding language support based on community needs. + + Learn more about how Codegen handles language specifics in the [Language + Support](/building-with-codegen/language-support) guide. + + + Interested in adding support for your language? [Let us know](https://x.com/codegen) or [contribute](/introduction/community)! + + - - The Codegen agent uses large language models to understand and modify code. - While powerful, its understanding isn't based on formal static analysis and - may not always be perfectly exact or catch all edge cases like a traditional - compiler or linter might. It aims for practical correctness based on the - provided context and instructions. + + Pretty much! Codegen is roughly on par with `mypy` and `tsc`. There are always edge cases in static analysis that are provably impossible to get (for example doing `eval()` on a string), but all of Codegen's APIs are intended to be exact unless otherwise specified. Please reach out if you find an edge case and we will do our best to patch it. - Yes! Codegen's agent is designed to work effectively on large, real-world - codebases. You can provide context and specific instructions to help it - navigate complex projects. + Yes! Codegen was developed on multmillion-line Python and Typescript codebases + and includes optimizations for handling large-scale transformations. - For enterprise use cases and support, please reach out to - [team@codegen.com](mailto:team@codegen.com) + For enterprise support, please reach out to [team@codegen.com](mailto:team@codegen.com) - - Yes. The Codegen SDK is a standard Python package (`pip install codegen`). - You can import and use it in your Python scripts, CI/CD pipelines, or any - other development tool that can execute Python code. + + Yes - [by design](/introduction/guiding-principles#python-first-composability). + + Codegen works like any other python package. It works alongside your IDE, version control system, and other development tools. - Start by trying out the Codegen agent and SDK, joining our [Slack - community](https://community.codegen.com), and reporting any issues or - feedback on [GitHub](https://github.com/codegen-sh/codegen-sdk). We welcome - contributions to documentation, examples, and SDK improvements. + Start by trying out Codegen, joining our [Slack community](https://community.codegen.com), and looking for + issues labeled "good first issue" on [GitHub](https://github.com/codegen-sh/graph-sitter). We welcome contributions to + documentation, examples, and code improvements. + + + Yes, Codegen is [open source](https://github.com/codegen-sh/graph-sitter) and free to use under the [Apache 2.0 + license](https://github.com/codegen-sh/graph-sitter?tab=Apache-2.0-1-ov-file). + You can use it for both personal and commercial projects. - The best places to get help are: 1. Our community [Slack - channel](https://community.codegen.com) 2. [GitHub - issues](https://github.com/codegen-sh/codegen-sdk) for bug reports or SDK - feature requests 3. Reach out to us on [Twitter](https://x.com/codegen) + The best places to get help are: + 1. Our community [Slack channel](https://community.codegen.com) + 2. [GitHub issues](https://github.com/codegen-sh/graph-sitter) for bug reports + 3. Reach out to us on [Twitter](https://x.com/codegen) diff --git a/docs/_deprecated/graph-sitter/getting-started.mdx b/docs/introduction/getting-started.mdx similarity index 98% rename from docs/_deprecated/graph-sitter/getting-started.mdx rename to docs/introduction/getting-started.mdx index a87fc47d8..321f740e0 100644 --- a/docs/_deprecated/graph-sitter/getting-started.mdx +++ b/docs/introduction/getting-started.mdx @@ -17,11 +17,11 @@ uv tool install codegen ## Quick Start with Jupyter -The [codegen notebook](/cli/notebook) command creates a virtual environment and opens a Jupyter notebook for quick prototyping. This is often the fastest way to get up and running. +The [gs notebook](/cli/notebook) command creates a virtual environment and opens a Jupyter notebook for quick prototyping. This is often the fastest way to get up and running. ```bash # Launch Jupyter with a demo notebook -codegen notebook --demo +gs notebook --demo ``` diff --git a/docs/introduction/how-it-works.mdx b/docs/introduction/how-it-works.mdx index d891a9c08..0cb0330cd 100644 --- a/docs/introduction/how-it-works.mdx +++ b/docs/introduction/how-it-works.mdx @@ -16,7 +16,7 @@ Codegen performs advanced static analysis to build a rich graph representation o Codegen is open source. Check out the [source - code](https://github.com/codegen-sh/codegen-sdk) to learn more! + code](https://github.com/codegen-sh/graph-sitter) to learn more! ## The Codebase Graph diff --git a/docs/graph-sitter/ide-usage.mdx b/docs/introduction/ide-usage.mdx similarity index 91% rename from docs/graph-sitter/ide-usage.mdx rename to docs/introduction/ide-usage.mdx index b1356c21f..62574847c 100644 --- a/docs/graph-sitter/ide-usage.mdx +++ b/docs/introduction/ide-usage.mdx @@ -7,11 +7,11 @@ iconType: "solid" Get up and running with Codegen programs in IDEs like VSCode, Cursor and PyCharm. -Make sure to [install and initialize](/introduction/installation) Codegen with `codegen init` +Make sure to [install and initialize](/introduction/installation) Codegen with `gs init` ## Configuring your IDE Interpreter -Codegen creates a custom Python environment in `.codegen/.venv`. Configure your IDE to use this environment for the best development experience. +gs creates a custom Python environment in `.codegen/.venv`. Configure your IDE to use this environment for the best development experience. @@ -100,10 +100,10 @@ https://docs.codegen.com/api-reference/index ## Create a New Codemod -Generate the boilerplate for a new code manipulation program using [codegen create](/cli/create): +Generate the boilerplate for a new code manipulation program using [gs create](/cli/create): ```bash -codegen create organize-types \ +gs create organize-types \ -d "Move all TypeScript types to \ into a centralized types.ts file" ``` @@ -123,7 +123,7 @@ The generated codemod includes type hints and docstrings, making it easy to get ## Iterating with Chat Assistants -When you do `codegen init`, you will receive a [system prompt optimized for AI consumption](/introduction/work-with-ai) at `.codegen/codegen-system-prompt.txt`. +When you do `gs init`, you will receive a [system prompt optimized for AI consumption](/introduction/work-with-ai) at `.codegen/codegen-system-prompt.txt`. If you reference this file in "chat" sessions with Copilot, Cursor, Cody, etc., the assistant will become fluent in Codegen. @@ -145,10 +145,10 @@ You can also drag and drop the system prompt ([available here](/introduction/wor ```bash # Run => write changes to disk -codegen run organize-types +gs run organize-types # Reset changes on disk -codegen reset +gs reset ``` You can also run the program directly via `.codegen/.venv/bin/python path/to/codemod.py` or via your editor's debugger diff --git a/docs/_deprecated/graph-sitter/installation.mdx b/docs/introduction/installation.mdx similarity index 85% rename from docs/_deprecated/graph-sitter/installation.mdx rename to docs/introduction/installation.mdx index 41188c64b..74c099046 100644 --- a/docs/_deprecated/graph-sitter/installation.mdx +++ b/docs/introduction/installation.mdx @@ -42,9 +42,9 @@ Let's walk through a minimal example of using Codegen in a project: cd path/to/your/project ``` -2. Initialize Codegen in your project with [codegen init](/cli/init): +2. Initialize Codegen in your project with [gs init](/cli/init): ```bash - codegen init + gs init ``` This creates a `.codegen/` directory with: @@ -57,25 +57,25 @@ Let's walk through a minimal example of using Codegen in a project: └── codegen-system-prompt.txt # AI system prompt ``` -3. Create your first codemod with [codegen create](/cli/create): +3. Create your first codemod with [gs create](/cli/create): ```bash - codegen create organize-imports \ + gs create organize-imports \ -d "Sort and organize imports according to PEP8" ``` - The `-d` flag in `codegen create` generates an AI-powered implementation. This requires a Github account registered on [codegen.sh](https://codegen.sh) + The `-d` flag in `gs create` generates an AI-powered implementation. This requires a Github account registered on [codegen.sh](https://codegen.sh) -4. Run your codemod with [codegen run](/cli/run): +4. Run your codemod with [gs run](/cli/run): ```bash - codegen run organize-imports + gs run organize-imports ``` -5. Reset any filesystem changes (excluding `.codegen/*`) with [codegen reset](/cli/reset): +5. Reset any filesystem changes (excluding `.codegen/*`) with [gs reset](/cli/reset): ```bash - codegen reset + gs reset ``` ## Troubleshooting diff --git a/docs/introduction/overview.mdx b/docs/introduction/overview.mdx index 082faca6d..c99982d12 100644 --- a/docs/introduction/overview.mdx +++ b/docs/introduction/overview.mdx @@ -5,104 +5,148 @@ icon: "robot" iconType: "solid" --- -Codegen provides intelligent AI agents designed to seamlessly integrate into your existing developer workflows. +[Codegen](https://github.com/codegen-sh/graph-sitter) is a python library for manipulating codebases. -Think of it as an AI coworker that can understand and solve coding challenges, access your codebase instantly, and interact directly with your development tools. +It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/). -Focus on higher-level tasks and leverage Codegen agents to do the low-level labor of software engineering. +```python +from codegen import Codebase -## What Can Codegen Agents Do? +# Codegen builds a complete graph connecting +# functions, classes, imports and their relationships +codebase = Codebase("./") -Codegen agents come equipped with a versatile set of tools and capabilities: +# Work with code without dealing with syntax trees or parsing +for function in codebase.functions: + # Comprehensive static analysis for references, dependencies, etc. + if not function.usages: + # Auto-handles references and imports to maintain correctness + function.remove() + +# Fast, in-memory code index +codebase.commit() +``` + + + +Codegen handles complex refactors while maintaining correctness, enabling a broad set of advanced code manipulation programs. + + +Codegen works with both Python and Typescript/JSX codebases. Learn more about language support [here](/building-with-codegen/language-support). + +## Quick Started + + +Codegen requires Python 3.12 - 3.13 (recommended: Python 3.13+). + + +### Using UV (Recommended) +```bash +uv tool install codegen --python 3.13 +``` + +### Using Pipx + + +Pipx is not officially supported by Codegen, but it should still work. + + +```bash +pipx install codegen +``` + + +For further & more in depth installation instructions, see the [installation guide](/introduction/installation). + + +## What can I do with Codegen? + +Codegen's simple yet powerful APIs enable a range of applications, including: - - Analyze requirements, implement features, fix bugs, write tests, and improve - documentation based on your prompts. - - Review PRs, suggest changes, comment on issues, create branches, commit - code, and manage repositories. + Generate interactive visualizations of your codebase's structure, dependencies, and relationships. - Update ticket statuses, add comments, link PRs to issues, and create new - tasks based on findings. - - - Send notifications, ask for clarification, report progress, and interact - directly with your team in Slack channels. + Create high-quality training data for fine-tuning LLMs on your codebase. - Safely run code, install dependencies, and test changes in an isolated - environment. - - - Access up-to-date information, research libraries, and find documentation - online. + Create powerful code transformations to automate large-scale changes. -## Get Started in Minutes +See below for an example call graph visualization generated with Codegen. + + + + + +View source code on [modal/modal-client](https://github.com/modal-labs/modal-client/blob/cbac0d80dfd98588027ecd21850152776be3ab82/modal/client.py#L70). View codemod on [codegen.sh](https://www.codegen.sh/codemod/66e2e195-ceec-4935-876a-ed4cfc1731c7/public/diff) + -Integrating Codegen into your workflow is designed to be quick and easy: +## Get Started + +import { + COMMUNITY_SLACK_URL, + CODEGEN_SDK_GITHUB_URL, +} from "/snippets/links.mdx"; - Install the GitHub App to grant the agent access to your repositories. No - complex setup required. + Follow our step-by-step tutorial to start manipulating code with Codegen. - - Add the Codegen Slack App to communicate with the agent directly in your - workspace. + + Learn how to use Codegen for common code transformation tasks. - - Connect your Linear workspace to enable agent interactions with your issues. + + Star us on GitHub and contribute to the project. - - Programmatically interact with agents using the Python SDK for advanced - automation. + + Get help and connect with the Codegen community. -## Enterprise-Grade Security +## Why Codegen? -Codegen is SOC 2 Type II certified, ensuring your code and data are handled with the highest standards for security, privacy, and compliance. +Many software engineering tasks - refactors, enforcing patterns, analyzing control flow, etc. - are fundamentally programmatic operations. Yet the tools we use to express these transformations often feel disconnected from how we think about code. -## Ready to Start? +Codegen was engineered backwards from real-world refactors we performed for enterprises at [Codegen, Inc.](/introduction/about). Instead of starting with theoretical abstractions, we built the set of APIs that map directly to how humans and AI think about code changes: - - - Codegen is free to install. Get started in just a few clicks. - - - Learn how to use Codegen for common code transformation tasks. - - +- **Natural Mental Model**: Express transformations through high-level operations that match how you reason about code changes, not low-level text or AST manipulation. +- **Clean Business Logic**: Let the engine handle the complexities of imports, references, and cross-file dependencies. +- **Scale with Confidence**: Make sweeping changes across large codebases consistently across Python, TypeScript, JavaScript, and React. + +As AI becomes increasingly sophisticated, we're seeing a fascinating shift: AI agents aren't bottlenecked by their ability to understand code or generate solutions. Instead, they're limited by their ability to efficiently manipulate codebases. The challenge isn't the "brain" - it's the "hands." + +We built Codegen with a key insight: future AI agents will need to ["act via code,"](/blog/act-via-code) building their own sophisticated tools for code manipulation. Rather than generating diffs or making direct text changes, these agents will: + +1. Express transformations as composable programs +2. Build higher-level tools by combining primitive operations +3. Create and maintain their own abstractions for common patterns + +This creates a shared language that both humans and AI can reason about effectively, making code changes more predictable, reviewable, and maintainable. Whether you're a developer writing a complex refactoring script or an AI agent building transformation tools, Codegen provides the foundation for expressing code changes as they should be: through code itself. diff --git a/docs/_deprecated/graph-sitter/work-with-ai.mdx b/docs/introduction/work-with-ai.mdx similarity index 89% rename from docs/_deprecated/graph-sitter/work-with-ai.mdx rename to docs/introduction/work-with-ai.mdx index 59001a95c..75d892c9c 100644 --- a/docs/_deprecated/graph-sitter/work-with-ai.mdx +++ b/docs/introduction/work-with-ai.mdx @@ -25,10 +25,10 @@ import { The [graph_sitter.cli](/cli/about) provides commands to generate `.md` files that can be fed to any AI assistant for more accurate and contextual help. -When you create a new codemod via [codegen create](/cli/create): +When you create a new codemod via [gs create](/cli/create): ```bash -codegen create delete-dead-imports . --description "Delete unused imports" +gs create delete-dead-imports . --description "Delete unused imports" ``` Codegen automatically generates an optimized ["system prompt"](https://news.ycombinator.com/item?id=37880023) that includes: @@ -41,7 +41,7 @@ You can find this generated prompt in the `.codegen/prompts/-syste All contents of the `.codegen/prompts` directory are by default ignored the - `.gitignore` file. after running [codegen init](/cli/init) + `.gitignore` file. after running [gs init](/cli/init) This `.md` file can be used with any AI assistant (Claude, GPT-4, etc.) to get more accurate and contextual help. @@ -52,7 +52,7 @@ This `.md` file can be used with any AI assistant (Claude, GPT-4, etc.) to get m Use the [create command](/cli/create) with a detailed description of what you want to accomplish: ```bash - codegen create modernize-components . --description "Convert class components to functional components with hooks" + gs create modernize-components . --description "Convert class components to functional components with hooks" ``` diff --git a/docs/mint.json b/docs/mint.json new file mode 100644 index 000000000..1012d3bf1 --- /dev/null +++ b/docs/mint.json @@ -0,0 +1,391 @@ +{ + "$schema": "https://mintlify.com/schema.json", + "name": "Codegen", + "logo": { + "dark": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45a3e32761c42b324b_Codegen_Logomark_Dark.svg", + "light": "https://cdn.prod.website-files.com/67070304751b9b01bf6a161c/679bcf45bf55446746125835_Codegen_Logomark_Light.svg" + }, + "modeToggle": { + "default": "dark" + }, + "metadata": { + "og:site_name": "Codegen", + "og:title": "Codegen - Manipulate Code at Scale", + "og:description": "A scriptable interface to a powerful, multi-lingual language server built on top of Tree-sitter.", + "og:url": "https://docs.codegen.com", + "og:locale": "en_US", + "og:logo": "https://i.imgur.com/f4OVOqI.png", + "article:publisher": "Codegen, Inc.", + "twitter:site": "@codegen" + }, + "favicon": "/favicon.svg", + "colors": { + "primary": "#a277ff", + "light": "#a277ff", + "dark": "#a277ff", + "anchors": { + "from": "#61ffca", + "to": "#61ffca" + } + }, + "theme": "prism", + "background": { + "style": "gradient" + }, + "analytics": { + "posthog": { + "apiKey": "phc_GLxaINoQJnuyCyxDmTciQqzdKBYFVDkY7bRBO4bDdso" + } + }, + "feedback": { + "thumbsRating": true + }, + "topbarCtaButton": { + "name": "GitHub", + "url": "https://github.com/codegen-sh/graph-sitter" + }, + "tabs": [ + { + "name": "API Reference", + "url": "/api-reference" + }, + { + "name": "CLI", + "url": "/cli" + }, + { + "name": "Blog", + "url": "/blog" + }, + { + "name": "Changelog", + "url": "/changelog" + }, + { + "name": "codegen", + "url": "/gen" + } + ], + "navigation": [ + { + "group": "Introduction", + "pages": [ + "introduction/overview", + "introduction/getting-started", + "introduction/installation", + "introduction/ide-usage", + "introduction/work-with-ai", + "introduction/how-it-works", + "introduction/advanced-settings", + "introduction/guiding-principles", + "introduction/community", + "introduction/about", + "introduction/faq" + ] + }, + { + "group": "Tutorials", + "pages": [ + "tutorials/at-a-glance", + "tutorials/deep-code-research", + "tutorials/codebase-analytics-dashboard", + "tutorials/training-data", + "tutorials/codebase-visualization", + "tutorials/migrating-apis", + "tutorials/organize-your-codebase", + "tutorials/promise-to-async-await", + "tutorials/modularity", + "tutorials/manage-feature-flags", + "tutorials/deleting-dead-code", + "tutorials/increase-type-coverage", + "tutorials/managing-typescript-exports", + "tutorials/converting-default-exports", + "tutorials/creating-documentation", + "tutorials/react-modernization", + "tutorials/unittest-to-pytest", + "tutorials/sqlalchemy-1.6-to-2.0", + "tutorials/fixing-import-loops-in-pytorch", + "tutorials/python2-to-python3", + "tutorials/flask-to-fastapi", + "tutorials/build-mcp", + "tutorials/neo4j-graph", + "tutorials/attributions" + ] + }, + { + "group": "Building with Codegen", + "pages": [ + "building-with-codegen/at-a-glance", + "building-with-codegen/parsing-codebases", + "building-with-codegen/reusable-codemods", + "building-with-codegen/dot-codegen", + "building-with-codegen/function-decorator", + "building-with-codegen/language-support", + "building-with-codegen/commit-and-reset", + "building-with-codegen/git-operations", + "building-with-codegen/files-and-directories", + "building-with-codegen/the-editable-api", + "building-with-codegen/symbol-api", + "building-with-codegen/class-api", + "building-with-codegen/imports", + "building-with-codegen/exports", + "building-with-codegen/inheritable-behaviors", + "building-with-codegen/statements-and-code-blocks", + "building-with-codegen/dependencies-and-usages", + "building-with-codegen/function-calls-and-callsites", + "building-with-codegen/variable-assignments", + "building-with-codegen/local-variables", + "building-with-codegen/comments-and-docstrings", + "building-with-codegen/external-modules", + "building-with-codegen/type-annotations", + "building-with-codegen/moving-symbols", + "building-with-codegen/collections", + "building-with-codegen/traversing-the-call-graph", + "building-with-codegen/react-and-jsx", + "building-with-codegen/codebase-visualization", + "building-with-codegen/flagging-symbols", + "building-with-codegen/calling-out-to-llms", + "building-with-codegen/semantic-code-search", + "building-with-codegen/reducing-conditions" + ] + }, + { + "group": "CLI", + "pages": [ + "cli/about", + "cli/init", + "cli/notebook", + "cli/create", + "cli/run", + "cli/reset", + "cli/expert" + ] + }, + { + "group": "Changelog", + "pages": ["changelog/changelog"] + }, + { + "group": "Blog", + "pages": [ + "blog/posts", + "blog/devin", + "blog/act-via-code", + "blog/promise-to-async-await-twilio", + "blog/fixing-import-loops" + ] + }, + { + "group": "codegen", + "pages": [ + "gen/introduction", + "gen/capabilities", + "gen/integrations", + "gen/faq" + ] + }, + { + "group": "API Reference", + "pages": [ + "api-reference/index", + { + "group": "Core", + "icon": "code", + "pages": [ + "api-reference/core/Argument", + "api-reference/core/Assignment", + "api-reference/core/AssignmentStatement", + "api-reference/core/Attribute", + "api-reference/core/AwaitExpression", + "api-reference/core/BinaryExpression", + "api-reference/core/BlockStatement", + "api-reference/core/Boolean", + "api-reference/core/Callable", + "api-reference/core/CatchStatement", + "api-reference/core/ChainedAttribute", + "api-reference/core/Class", + "api-reference/core/CodeBlock", + "api-reference/core/CodeOwner", + "api-reference/core/Codebase", + "api-reference/core/Comment", + "api-reference/core/CommentGroup", + "api-reference/core/ComparisonExpression", + "api-reference/core/Decorator", + "api-reference/core/Dict", + "api-reference/core/Directory", + "api-reference/core/Editable", + "api-reference/core/Export", + "api-reference/core/ExportStatement", + "api-reference/core/Exportable", + "api-reference/core/Expression", + "api-reference/core/ExpressionGroup", + "api-reference/core/ExpressionStatement", + "api-reference/core/ExternalModule", + "api-reference/core/File", + "api-reference/core/FlagKwargs", + "api-reference/core/ForLoopStatement", + "api-reference/core/Function", + "api-reference/core/FunctionCall", + "api-reference/core/GenericType", + "api-reference/core/HasBlock", + "api-reference/core/HasName", + "api-reference/core/HasValue", + "api-reference/core/IfBlockStatement", + "api-reference/core/Import", + "api-reference/core/ImportStatement", + "api-reference/core/ImportType", + "api-reference/core/Importable", + "api-reference/core/Interface", + "api-reference/core/List", + "api-reference/core/MessageType", + "api-reference/core/MultiExpression", + "api-reference/core/MultiLineCollection", + "api-reference/core/Name", + "api-reference/core/NamedType", + "api-reference/core/NoneType", + "api-reference/core/Number", + "api-reference/core/Pair", + "api-reference/core/Parameter", + "api-reference/core/ParenthesizedExpression", + "api-reference/core/Placeholder", + "api-reference/core/PlaceholderType", + "api-reference/core/RaiseStatement", + "api-reference/core/ReturnStatement", + "api-reference/core/SourceFile", + "api-reference/core/Span", + "api-reference/core/Statement", + "api-reference/core/StatementType", + "api-reference/core/String", + "api-reference/core/StubPlaceholder", + "api-reference/core/SubscriptExpression", + "api-reference/core/SwitchCase", + "api-reference/core/SwitchStatement", + "api-reference/core/Symbol", + "api-reference/core/SymbolGroup", + "api-reference/core/SymbolStatement", + "api-reference/core/TernaryExpression", + "api-reference/core/TryCatchStatement", + "api-reference/core/Tuple", + "api-reference/core/TupleType", + "api-reference/core/Type", + "api-reference/core/TypeAlias", + "api-reference/core/TypePlaceholder", + "api-reference/core/Typeable", + "api-reference/core/UnaryExpression", + "api-reference/core/UnionType", + "api-reference/core/Unpack", + "api-reference/core/Unwrappable", + "api-reference/core/Usable", + "api-reference/core/Usage", + "api-reference/core/UsageKind", + "api-reference/core/UsageType", + "api-reference/core/Value", + "api-reference/core/WhileStatement", + "api-reference/core/WithStatement" + ] + }, + { + "group": "Python", + "icon": "python", + "pages": [ + "api-reference/python/PyAssignment", + "api-reference/python/PyAssignmentStatement", + "api-reference/python/PyAttribute", + "api-reference/python/PyBlockStatement", + "api-reference/python/PyBreakStatement", + "api-reference/python/PyCatchStatement", + "api-reference/python/PyChainedAttribute", + "api-reference/python/PyClass", + "api-reference/python/PyCodeBlock", + "api-reference/python/PyComment", + "api-reference/python/PyCommentGroup", + "api-reference/python/PyCommentType", + "api-reference/python/PyConditionalExpression", + "api-reference/python/PyDecorator", + "api-reference/python/PyFile", + "api-reference/python/PyForLoopStatement", + "api-reference/python/PyFunction", + "api-reference/python/PyGenericType", + "api-reference/python/PyHasBlock", + "api-reference/python/PyIfBlockStatement", + "api-reference/python/PyImport", + "api-reference/python/PyImportStatement", + "api-reference/python/PyMatchCase", + "api-reference/python/PyMatchStatement", + "api-reference/python/PyNamedType", + "api-reference/python/PyParameter", + "api-reference/python/PyPassStatement", + "api-reference/python/PyReturnTypePlaceholder", + "api-reference/python/PyString", + "api-reference/python/PySymbol", + "api-reference/python/PyTryCatchStatement", + "api-reference/python/PyUnionType", + "api-reference/python/PyWhileStatement" + ] + }, + { + "group": "Typescript", + "icon": "js", + "pages": [ + "api-reference/typescript/JSXElement", + "api-reference/typescript/JSXExpression", + "api-reference/typescript/JSXProp", + "api-reference/typescript/TSArrayType", + "api-reference/typescript/TSAssignment", + "api-reference/typescript/TSAssignmentStatement", + "api-reference/typescript/TSAttribute", + "api-reference/typescript/TSBlockStatement", + "api-reference/typescript/TSCatchStatement", + "api-reference/typescript/TSChainedAttribute", + "api-reference/typescript/TSClass", + "api-reference/typescript/TSCodeBlock", + "api-reference/typescript/TSComment", + "api-reference/typescript/TSCommentGroup", + "api-reference/typescript/TSCommentType", + "api-reference/typescript/TSConditionalType", + "api-reference/typescript/TSConfig", + "api-reference/typescript/TSDecorator", + "api-reference/typescript/TSDict", + "api-reference/typescript/TSEnum", + "api-reference/typescript/TSExport", + "api-reference/typescript/TSExpressionType", + "api-reference/typescript/TSFile", + "api-reference/typescript/TSForLoopStatement", + "api-reference/typescript/TSFunction", + "api-reference/typescript/TSFunctionType", + "api-reference/typescript/TSGenericType", + "api-reference/typescript/TSHasBlock", + "api-reference/typescript/TSIfBlockStatement", + "api-reference/typescript/TSImport", + "api-reference/typescript/TSImportStatement", + "api-reference/typescript/TSInterface", + "api-reference/typescript/TSLabeledStatement", + "api-reference/typescript/TSLookupType", + "api-reference/typescript/TSNamedType", + "api-reference/typescript/TSNamespace", + "api-reference/typescript/TSObjectType", + "api-reference/typescript/TSPair", + "api-reference/typescript/TSParameter", + "api-reference/typescript/TSQueryType", + "api-reference/typescript/TSReadonlyType", + "api-reference/typescript/TSReturnTypePlaceholder", + "api-reference/typescript/TSString", + "api-reference/typescript/TSSwitchCase", + "api-reference/typescript/TSSwitchStatement", + "api-reference/typescript/TSSymbol", + "api-reference/typescript/TSTernaryExpression", + "api-reference/typescript/TSTryCatchStatement", + "api-reference/typescript/TSTypeAlias", + "api-reference/typescript/TSUndefinedType", + "api-reference/typescript/TSUnionType", + "api-reference/typescript/TSWhileStatement" + ] + } + ] + } + ], + "footerSocials": { + "x": "https://x.com/codegen", + "linkedin": "https://linkedin.com/company/codegen-dot-com" + } +} diff --git a/docs/snippets/links.mdx b/docs/snippets/links.mdx index d524b1bd0..7ac98b7fe 100644 --- a/docs/snippets/links.mdx +++ b/docs/snippets/links.mdx @@ -1,9 +1,9 @@ export const COMMUNITY_SLACK_URL = "https://community.codegen.com"; export const CODEGEN_SDK_GITHUB_URL = - "https://github.com/codegen-sh/codegen-sdk"; + "https://github.com/codegen-sh/graph-sitter"; export const CODEGEN_SDK_EXAMPLES_GITHUB_URL = - "https://github.com/codegen-sh/codegen-examples"; + "https://github.com/codegen-sh/graph-sitter-examples"; -export const CODEGEN_SYSTEM_PROMPT = "https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/src/codegen/sdk/system-prompt.txt" \ No newline at end of file +export const CODEGEN_SYSTEM_PROMPT = "https://raw.githubusercontent.com/codegen-sh/graph-sitter/refs/heads/develop/src/codegen/sdk/system-prompt.txt" \ No newline at end of file diff --git a/docs/_deprecated/tutorials/at-a-glance.mdx b/docs/tutorials/at-a-glance.mdx similarity index 94% rename from docs/_deprecated/tutorials/at-a-glance.mdx rename to docs/tutorials/at-a-glance.mdx index 87c8f467f..0f65ca14a 100644 --- a/docs/_deprecated/tutorials/at-a-glance.mdx +++ b/docs/tutorials/at-a-glance.mdx @@ -10,13 +10,6 @@ Explore our tutorials to learn how to use Codegen for various code transformatio ## Featured Tutorials - - Create an intelligent code agent with Langchain and powerful, codegen-powered tools - View the full code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/graph_sitter.extensions/mcp) +View the full code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/src/graph_sitter.extensions/mcp) ## Setup: diff --git a/docs/_deprecated/tutorials/codebase-analytics-dashboard.mdx b/docs/tutorials/codebase-analytics-dashboard.mdx similarity index 100% rename from docs/_deprecated/tutorials/codebase-analytics-dashboard.mdx rename to docs/tutorials/codebase-analytics-dashboard.mdx diff --git a/docs/_deprecated/tutorials/codebase-visualization.mdx b/docs/tutorials/codebase-visualization.mdx similarity index 100% rename from docs/_deprecated/tutorials/codebase-visualization.mdx rename to docs/tutorials/codebase-visualization.mdx diff --git a/docs/_deprecated/tutorials/converting-default-exports.mdx b/docs/tutorials/converting-default-exports.mdx similarity index 100% rename from docs/_deprecated/tutorials/converting-default-exports.mdx rename to docs/tutorials/converting-default-exports.mdx diff --git a/docs/_deprecated/tutorials/creating-documentation.mdx b/docs/tutorials/creating-documentation.mdx similarity index 100% rename from docs/_deprecated/tutorials/creating-documentation.mdx rename to docs/tutorials/creating-documentation.mdx diff --git a/docs/_deprecated/tutorials/deep-code-research.mdx b/docs/tutorials/deep-code-research.mdx similarity index 98% rename from docs/_deprecated/tutorials/deep-code-research.mdx rename to docs/tutorials/deep-code-research.mdx index ec210a520..5ea4e4700 100644 --- a/docs/_deprecated/tutorials/deep-code-research.mdx +++ b/docs/tutorials/deep-code-research.mdx @@ -7,7 +7,7 @@ iconType: "solid" This guide demonstrates how to build an intelligent code research tool that can analyze and explain codebases using Codegen's and LangChain. The tool combines semantic code search, dependency analysis, and natural language understanding to help developers quickly understand new codebases. -View the full code on [GitHub](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/deep_code_research) +View the full code on [GitHub](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/deep_code_research) This example works with any public GitHub repository - just provide the repo name in the format owner/repo diff --git a/docs/_deprecated/tutorials/deleting-dead-code.mdx b/docs/tutorials/deleting-dead-code.mdx similarity index 100% rename from docs/_deprecated/tutorials/deleting-dead-code.mdx rename to docs/tutorials/deleting-dead-code.mdx diff --git a/docs/_deprecated/tutorials/fixing-import-loops-in-pytorch.mdx b/docs/tutorials/fixing-import-loops-in-pytorch.mdx similarity index 98% rename from docs/_deprecated/tutorials/fixing-import-loops-in-pytorch.mdx rename to docs/tutorials/fixing-import-loops-in-pytorch.mdx index 2c9faf55d..5656c376d 100644 --- a/docs/_deprecated/tutorials/fixing-import-loops-in-pytorch.mdx +++ b/docs/tutorials/fixing-import-loops-in-pytorch.mdx @@ -23,7 +23,7 @@ Import loops occur when two or more Python modules depend on each other, creatin In this tutorial, we'll explore how to identify and fix problematic import cycles using Codegen. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch). +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/removing_import_loops_in_pytorch). ## Overview diff --git a/docs/_deprecated/tutorials/flask-to-fastapi.mdx b/docs/tutorials/flask-to-fastapi.mdx similarity index 97% rename from docs/_deprecated/tutorials/flask-to-fastapi.mdx rename to docs/tutorials/flask-to-fastapi.mdx index 69e743f5e..a800b61f2 100644 --- a/docs/_deprecated/tutorials/flask-to-fastapi.mdx +++ b/docs/tutorials/flask-to-fastapi.mdx @@ -7,7 +7,7 @@ iconType: "solid" Migrating from [Flask](https://flask.palletsprojects.com/) to [FastAPI](https://fastapi.tiangolo.com/) involves several key changes to your codebase. This guide will walk you through using Codegen to automate this migration, handling imports, route decorators, static files, and template rendering. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/flask_to_fastapi_migration) +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/flask_to_fastapi_migration) ## Overview @@ -183,7 +183,7 @@ def list_users(request: Request): You can run the complete migration using our example script: ```bash -git clone https://github.com/codegen-sh/codegen-sdk.git +git clone https://github.com/codegen-sh/graph-sitter.git cd codegen-examples/examples/flask_to_fastapi_migration python run.py ``` diff --git a/docs/_deprecated/tutorials/increase-type-coverage.mdx b/docs/tutorials/increase-type-coverage.mdx similarity index 100% rename from docs/_deprecated/tutorials/increase-type-coverage.mdx rename to docs/tutorials/increase-type-coverage.mdx diff --git a/docs/_deprecated/tutorials/manage-feature-flags.mdx b/docs/tutorials/manage-feature-flags.mdx similarity index 100% rename from docs/_deprecated/tutorials/manage-feature-flags.mdx rename to docs/tutorials/manage-feature-flags.mdx diff --git a/docs/_deprecated/tutorials/managing-typescript-exports.mdx b/docs/tutorials/managing-typescript-exports.mdx similarity index 100% rename from docs/_deprecated/tutorials/managing-typescript-exports.mdx rename to docs/tutorials/managing-typescript-exports.mdx diff --git a/docs/_deprecated/tutorials/migrating-apis.mdx b/docs/tutorials/migrating-apis.mdx similarity index 100% rename from docs/_deprecated/tutorials/migrating-apis.mdx rename to docs/tutorials/migrating-apis.mdx diff --git a/docs/_deprecated/tutorials/modularity.mdx b/docs/tutorials/modularity.mdx similarity index 100% rename from docs/_deprecated/tutorials/modularity.mdx rename to docs/tutorials/modularity.mdx diff --git a/docs/_deprecated/tutorials/neo4j-graph.mdx b/docs/tutorials/neo4j-graph.mdx similarity index 100% rename from docs/_deprecated/tutorials/neo4j-graph.mdx rename to docs/tutorials/neo4j-graph.mdx diff --git a/docs/_deprecated/tutorials/organize-your-codebase.mdx b/docs/tutorials/organize-your-codebase.mdx similarity index 100% rename from docs/_deprecated/tutorials/organize-your-codebase.mdx rename to docs/tutorials/organize-your-codebase.mdx diff --git a/docs/_deprecated/tutorials/preparing-your-codebase-for-ai.mdx b/docs/tutorials/preparing-your-codebase-for-ai.mdx similarity index 100% rename from docs/_deprecated/tutorials/preparing-your-codebase-for-ai.mdx rename to docs/tutorials/preparing-your-codebase-for-ai.mdx diff --git a/docs/_deprecated/tutorials/promise-to-async-await.mdx b/docs/tutorials/promise-to-async-await.mdx similarity index 94% rename from docs/_deprecated/tutorials/promise-to-async-await.mdx rename to docs/tutorials/promise-to-async-await.mdx index 2811ee2ae..1cffafae6 100644 --- a/docs/_deprecated/tutorials/promise-to-async-await.mdx +++ b/docs/tutorials/promise-to-async-await.mdx @@ -8,7 +8,7 @@ iconType: "solid" Modern JavaScript/TypeScript codebases often need to migrate from Promise-based code to the more readable async/await syntax. Codegen provides powerful tools to automate this conversion while preserving business logic and handling complex scenarios. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/blob/develop/codegen-examples/examples/promises_to_async_await/promises_to_async_await.ipynb). +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/blob/develop/codegen-examples/examples/promises_to_async_await/promises_to_async_await.ipynb). @@ -96,7 +96,7 @@ new_code = promise_statement.edit( - Ambiguous/conditional return blocks -A list of all the covered cases can be found in the [example notebook](https://github.com/codegen-sh/codegen-sdk/tree/codegen-examples/examples/promises_to_async_await/promise_to_async_await.ipynb). +A list of all the covered cases can be found in the [example notebook](https://github.com/codegen-sh/graph-sitter/tree/codegen-examples/examples/promises_to_async_await/promise_to_async_await.ipynb). @@ -271,4 +271,4 @@ Here are some next steps to ensure a successful migration: 1. Ensure to run `npx prettier --write .` after the migration to fix indentation + linting 2. **Incremental Migration**: Convert one module at a time 3. **Handle Additional Business Logic**: Use `.promise_statement.edit()` to modify the entire chain and handle external business logic -4. If the specific conversion case is not covered, open an issue on the [Codegen](https://github.com/codegen-sh/codegen-sdk) repository or try to right your own transformation logic using the codegen-sdk +4. If the specific conversion case is not covered, open an issue on the [Codegen](https://github.com/codegen-sh/graph-sitter) repository or try to right your own transformation logic using the codegen-sdk diff --git a/docs/_deprecated/tutorials/python2-to-python3.mdx b/docs/tutorials/python2-to-python3.mdx similarity index 97% rename from docs/_deprecated/tutorials/python2-to-python3.mdx rename to docs/tutorials/python2-to-python3.mdx index 08e61648c..6816c8ec2 100644 --- a/docs/_deprecated/tutorials/python2-to-python3.mdx +++ b/docs/tutorials/python2-to-python3.mdx @@ -9,7 +9,7 @@ iconType: "solid" Migrating from Python 2 to Python 3 involves several syntax and API changes. This guide will walk you through using Codegen to automate this migration, handling print statements, string handling, iterators, and more. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/python2_to_python3). +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/python2_to_python3). ## Overview @@ -222,7 +222,7 @@ class MyIterator: You can run the complete migration using our example script: ```bash -git clone https://github.com/codegen-sh/codegen-sdk.git +git clone https://github.com/codegen-sh/graph-sitter.git cd codegen-examples/examples/python2_to_python3 python run.py ``` diff --git a/docs/_deprecated/tutorials/react-modernization.mdx b/docs/tutorials/react-modernization.mdx similarity index 100% rename from docs/_deprecated/tutorials/react-modernization.mdx rename to docs/tutorials/react-modernization.mdx diff --git a/docs/_deprecated/tutorials/sqlalchemy-1.6-to-2.0.mdx b/docs/tutorials/sqlalchemy-1.6-to-2.0.mdx similarity index 97% rename from docs/_deprecated/tutorials/sqlalchemy-1.6-to-2.0.mdx rename to docs/tutorials/sqlalchemy-1.6-to-2.0.mdx index daee01f8b..366d9b235 100644 --- a/docs/_deprecated/tutorials/sqlalchemy-1.6-to-2.0.mdx +++ b/docs/tutorials/sqlalchemy-1.6-to-2.0.mdx @@ -9,7 +9,7 @@ iconType: "solid" Migrating from [SQLAlchemy](https://www.sqlalchemy.org/) 1.4 to 2.0 involves several API changes to support the new 2.0-style query interface. This guide will walk you through using Codegen to automate this migration, handling query syntax, session usage, and ORM patterns. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/sqlalchemy_1.4_to_2.0). +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/sqlalchemy_1.4_to_2.0). ## Overview diff --git a/docs/_deprecated/tutorials/training-data.mdx b/docs/tutorials/training-data.mdx similarity index 98% rename from docs/_deprecated/tutorials/training-data.mdx rename to docs/tutorials/training-data.mdx index f513e292b..e44d20e15 100644 --- a/docs/_deprecated/tutorials/training-data.mdx +++ b/docs/tutorials/training-data.mdx @@ -8,7 +8,7 @@ iconType: "solid" This guide demonstrates how to use Codegen to generate high-quality training data for large language models (LLMs) by extracting function implementations along with their dependencies and usages. This approach is similar to [word2vec](https://www.tensorflow.org/text/tutorials/word2vec) or [node2vec](https://snap.stanford.edu/node2vec/) - given the context of a function, learn to predict the function's implementation. -View the full code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/generate_training_data) +View the full code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/generate_training_data) This example works with both Python and Typescript repositories without modification diff --git a/docs/_deprecated/tutorials/unittest-to-pytest.mdx b/docs/tutorials/unittest-to-pytest.mdx similarity index 97% rename from docs/_deprecated/tutorials/unittest-to-pytest.mdx rename to docs/tutorials/unittest-to-pytest.mdx index bf633308c..37d4e237d 100644 --- a/docs/_deprecated/tutorials/unittest-to-pytest.mdx +++ b/docs/tutorials/unittest-to-pytest.mdx @@ -9,7 +9,7 @@ iconType: "solid" Migrating from [unittest](https://docs.python.org/3/library/unittest.html) to [pytest](https://docs.pytest.org/) involves converting test classes and assertions to pytest's more modern and concise style. This guide will walk you through using Codegen to automate this migration. -You can find the complete example code in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/unittest_to_pytest). +You can find the complete example code in our [examples repository](https://github.com/codegen-sh/graph-sitter/tree/develop/codegen-examples/examples/unittest_to_pytest). ## Overview diff --git a/examples.md b/examples.md index d46b0e7c5..04c8616f5 100644 --- a/examples.md +++ b/examples.md @@ -2,6 +2,6 @@ For practical examples of using Codegen in real-world scenarios, please visit our dedicated examples repository: -[github.com/codegen-sh/codegen-examples](https://github.com/codegen-sh/codegen-examples) +[github.com/codegen-sh/graph-sitter-examples](https://github.com/codegen-sh/graph-sitter-examples) For docs and tutorials, please visit [docs.codegen.com](https://docs.codegen.com) diff --git a/pyproject.toml b/pyproject.toml index 213cf80c7..89a083692 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,7 @@ dependencies = [ "urllib3>=2.0.0", "datasets", "colorlog>=6.9.0", + "codegen-sdk-pink>=0.1.0", ] # renovate: datasource=python-version depName=python diff --git a/src/graph_sitter/README.md b/src/graph_sitter/README.md deleted file mode 100644 index 4fe659727..000000000 --- a/src/graph_sitter/README.md +++ /dev/null @@ -1,117 +0,0 @@ -
- -

- - - -

- -

- Scriptable interface to a powerful, multi-lingual language server. -

- -
- -[![PyPI](https://img.shields.io/badge/PyPi-codegen-gray?style=flat-square&color=blue)](https://pypi.org/project/codegen/) -[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) -[![Slack Community](https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&style=flat-square)](https://community.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) -[![Follow on X](https://img.shields.io/twitter/follow/codegen?style=social)](https://x.com/codegen) - -
- -
- -[Codegen](https://docs.codegen.com) is a python library for manipulating codebases. - -```python -from graph_sitter import Codebase - -# Codegen builds a complete graph connecting -# functions, classes, imports and their relationships -codebase = Codebase("./") - -# Work with code without dealing with syntax trees or parsing -for function in codebase.functions: - # Comprehensive static analysis for references, dependencies, etc. - if not function.usages: - # Auto-handles references and imports to maintain correctness - function.move_to_file("deprecated.py") -``` - -Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale. - -## Installation and Usage - -We support - -- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+) -- macOS and Linux - - macOS is supported - - Linux is supported on x86_64 and aarch64 with glibc 2.34+ - - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details. -- Python, Typescript, Javascript and React codebases - -``` -# Install inside existing project -uv pip install codegen - -# Install global CLI -uv tool install codegen --python 3.13 - -# Create a codemod for a given repo -cd path/to/repo -codegen init -codegen create test-function - -# Run the codemod -codegen run test-function - -# Create an isolated venv with codegen => open jupyter -codegen notebook -``` - -## Usage - -See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial. - -``` -from graph_sitter import Codebase -``` - -## Troubleshooting - -Having issues? Here are some common problems and their solutions: - -- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`. -- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`. -- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`. - -If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out! - -## Resources - -- [Docs](https://docs.codegen.com) -- [Getting Started](https://docs.codegen.com/introduction/getting-started) -- [Contributing](CONTRIBUTING.md) -- [Contact Us](https://codegen.com/contact) - -## Why Codegen? - -Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves. - -We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes: - -- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management. - -- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code. - -- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself. - -## Contributing - -Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. - -## Enterprise - -For more information on enterprise engagements, please [contact us](https://codegen.com/contact) or [request a demo](https://codegen.com/request-demo). diff --git a/src/graph_sitter/cli/README.md b/src/graph_sitter/cli/README.md index b5fe79448..101f1b034 100644 --- a/src/graph_sitter/cli/README.md +++ b/src/graph_sitter/cli/README.md @@ -4,8 +4,8 @@ A codegen module that handles all `codegen` CLI commands. ### Dependencies -- [codegen.sdk](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/sdk) -- [codegen.shared](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/shared) +- [codegen.sdk](https://github.com/codegen-sh/graph-sitter/tree/develop/src/codegen/sdk) +- [codegen.shared](https://github.com/codegen-sh/graph-sitter/tree/develop/src/codegen/shared) ## Best Practices diff --git a/src/graph_sitter/cli/auth/decorators.py b/src/graph_sitter/cli/auth/decorators.py index 785e4c566..34d961477 100644 --- a/src/graph_sitter/cli/auth/decorators.py +++ b/src/graph_sitter/cli/auth/decorators.py @@ -20,7 +20,7 @@ def wrapper(*args, **kwargs): # Check for valid session if session is None: - pretty_print_error("There is currently no active session.\nPlease run 'codegen init' to initialize the project.") + pretty_print_error("There is currently no active session.\nPlease run 'gs init' to initialize the project.") raise click.Abort() if (token := get_current_token()) is None: diff --git a/src/graph_sitter/cli/auth/session.py b/src/graph_sitter/cli/auth/session.py index cff1ad45c..354e0916c 100644 --- a/src/graph_sitter/cli/auth/session.py +++ b/src/graph_sitter/cli/auth/session.py @@ -67,7 +67,7 @@ def _validate(self) -> None: rich.print("To enable full functionality, please set your GitHub token:") rich.print(format_command("export GITHUB_TOKEN=")) rich.print("Or pass in as a parameter:") - rich.print(format_command("codegen init --token ")) + rich.print(format_command("gs init --token ")) if self.local_git.origin_remote is None: rich.print("\n[bold yellow]Warning:[/bold yellow] No remote found for repository") diff --git a/src/graph_sitter/cli/codemod/convert.py b/src/graph_sitter/cli/codemod/convert.py index c869298f0..8c99420f4 100644 --- a/src/graph_sitter/cli/codemod/convert.py +++ b/src/graph_sitter/cli/codemod/convert.py @@ -3,7 +3,7 @@ def convert_to_cli(input: str, language: str, name: str) -> str: return f""" -# Run this codemod using `codegen run {name}` OR the `run_codemod` MCP tool. +# Run this codemod using `gs run {name}` OR the `run_codemod` MCP tool. # Important: if you run this as a regular python file, you MUST run it such that # the base directory './' is the base of your codebase, otherwise it will not work. import codegen diff --git a/src/graph_sitter/cli/commands/create/main.py b/src/graph_sitter/cli/commands/create/main.py index ae8ffdd14..a5ae4142b 100644 --- a/src/graph_sitter/cli/commands/create/main.py +++ b/src/graph_sitter/cli/commands/create/main.py @@ -83,7 +83,7 @@ def create_command(session: CodegenSession, name: str, path: Path | None, descri # Check if file exists if codemod_path.exists() and not overwrite: rel_path = make_relative(codemod_path) - pretty_print_error(f"File already exists at {format_path(rel_path)}\n\nTo overwrite the file:\n{format_command(f'codegen create {name} {rel_path} --overwrite')}") + pretty_print_error(f"File already exists at {format_path(rel_path)}\n\nTo overwrite the file:\n{format_command(f'gs create {name} {rel_path} --overwrite')}") return response = None @@ -120,4 +120,4 @@ def create_command(session: CodegenSession, name: str, path: Path | None, descri # Next steps rich.print("\n[bold]What's next?[/bold]\n") rich.print("1. Review and edit the function to customize its behavior") - rich.print(f"2. Run it with: \n{format_command(f'codegen run {name}')}") + rich.print(f"2. Run it with: \n{format_command(f'gs run {name}')}") diff --git a/src/graph_sitter/cli/commands/deploy/main.py b/src/graph_sitter/cli/commands/deploy/main.py index 71d51f0c6..a94fb1058 100644 --- a/src/graph_sitter/cli/commands/deploy/main.py +++ b/src/graph_sitter/cli/commands/deploy/main.py @@ -39,7 +39,7 @@ def deploy_functions(functions: list[DecoratedFunction], message: str | None = N func_type = "Webhook" if func.lint_mode else "Function" rich.print(f"āœ… {func_type} '{func.name}' deployed in {deploy_time:.3f}s! šŸŽ‰") rich.print(" [dim]View deployment:[/dim]") - rich.print(format_command(f"codegen run {func.name}")) + rich.print(format_command(f"gs run {func.name}")) @click.command(name="deploy") diff --git a/src/graph_sitter/cli/commands/init/main.py b/src/graph_sitter/cli/commands/init/main.py index 81e03f11e..b3121faf2 100644 --- a/src/graph_sitter/cli/commands/init/main.py +++ b/src/graph_sitter/cli/commands/init/main.py @@ -28,7 +28,7 @@ def init_command(path: str | None = None, token: str | None = None, language: st rich.print("[white]Please run this command from within a git repository.[/white]") rich.print("\n[dim]To initialize a new git repository:[/dim]") rich.print(format_command("git init")) - rich.print(format_command("codegen init")) + rich.print(format_command("gs init")) sys.exit(1) session = CodegenSession(repo_path=repo_path, git_token=token) @@ -46,6 +46,6 @@ def init_command(path: str | None = None, token: str | None = None, language: st # Print next steps rich.print("\n[bold]What's next?[/bold]\n") rich.print("1. Create a function:") - rich.print(format_command('codegen create my-function . -d "describe what you want to do"')) + rich.print(format_command('gs create my-function . -d "describe what you want to do"')) rich.print("2. Run it:") - rich.print(format_command("codegen run my-function --apply-local")) + rich.print(format_command("gs run my-function --apply-local")) diff --git a/src/graph_sitter/cli/commands/list/main.py b/src/graph_sitter/cli/commands/list/main.py index 7a09985b5..ace95faf4 100644 --- a/src/graph_sitter/cli/commands/list/main.py +++ b/src/graph_sitter/cli/commands/list/main.py @@ -32,7 +32,7 @@ def list_command(): rich.print(table) rich.print("\nRun a function with:") - rich.print(format_command("codegen run