diff --git a/docs/api-reference/core/Argument.mdx b/docs/api-reference/core/Argument.mdx index a6bedf024..322244f71 100644 --- a/docs/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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -59,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -89,11 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type str } description="Gets the `Tree-sitter` type of the argument's value node." /> @@ -111,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=""/> @@ -136,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=""/> @@ -233,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -346,7 +330,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=""/> @@ -354,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=""/> @@ -362,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 [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) @@ -53,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -90,15 +74,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -122,17 +100,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.GlobalVar." /> ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ Assignment ] } description="The type annotation associated with this node" /> ### value @@ -147,7 +119,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=""/> @@ -189,7 +161,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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=""/> @@ -286,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 the current symbol node in the Abstract Syntax Tree. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -413,7 +385,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=""/> @@ -467,7 +439,7 @@ Simplifies an assignment expression by reducing it based on a boolean 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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -25,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" -" /> +list[ Assignment ] } description="A list of assignments within the statement." /> ### extended @@ -40,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -59,8 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ Assignment ] } description="The left-hand side expression of the first assignment." /> ### nested_code_blocks @@ -70,15 +58,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ AssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -98,23 +80,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ Assignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -128,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=""/> @@ -136,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=""/> @@ -225,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -338,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=""/> @@ -346,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=""/> @@ -354,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 [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) @@ -20,13 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignment -Assignment } description=" -" /> +Assignment } description="The assignment associated with the attribute." /> ### assignments -list[ Assignment ] } description=" -" /> +list[ Assignment ] } description="A list of assignments within the statement." /> ### dependencies @@ -44,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -75,8 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ Assignment ] } description="The left-hand side expression of the first assignment." /> ### name @@ -90,15 +82,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ Attribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -118,23 +104,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ Assignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -148,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=""/> @@ -156,7 +131,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[ Attribute ] } description=""/> @@ -253,7 +228,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -366,7 +341,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=""/> @@ -374,7 +349,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=""/> @@ -382,7 +357,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_value Sets the value of a node's assignment. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -43,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Gets all function calls within the await expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -73,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -91,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=""/> @@ -99,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=""/> @@ -188,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +285,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 +293,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 +301,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) @@ -34,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -49,13 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ ComparisonExpression ] | None } description=" -" /> - -### node_type - -NodeType } description=" -" /> +Expression [ BinaryExpression ] | None } description="The left operand of the binary expression." /> ### operators @@ -63,8 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -84,18 +72,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ ComparisonExpression ] | None } description=" -" /> +Expression [ BinaryExpression ] | None } description="The right operand of the binary expression." /> ### source str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -105,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=""/> @@ -113,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=""/> @@ -202,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -315,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=""/> @@ -323,7 +305,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) @@ -20,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +CodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -43,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -72,15 +66,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ BlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -102,16 +90,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -121,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=""/> @@ -152,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=""/> @@ -241,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -354,7 +332,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=""/> @@ -362,7 +340,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=""/> @@ -370,7 +348,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. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -46,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -76,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -90,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=""/> @@ -98,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=""/> @@ -187,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,7 +281,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=""/> @@ -308,7 +289,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=""/> @@ -316,7 +297,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) @@ -41,11 +38,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -62,19 +54,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parameters SymbolGroup [ Parameter , Callable ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -94,18 +80,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ Callable ] } description="The type of value returned by the callable, or a placeholder." /> ### source str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -115,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=""/> @@ -123,7 +103,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[ Callable ] } description=""/> @@ -220,7 +200,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -384,7 +364,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=""/> @@ -392,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=""/> @@ -400,7 +380,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + ### code_block -CodeBlock | None } description=" -" /> +CodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition -Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> +Expression [ CatchStatement ] | None } description="The condition which triggers this clause" /> ### decorators @@ -52,11 +46,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -81,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ CatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -111,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -130,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=""/> @@ -161,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=""/> @@ -250,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -363,7 +336,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=""/> @@ -371,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=""/> @@ -379,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. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -38,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,19 +46,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### object Object } description="Returns the object that contains the attribute being looked up." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -111,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[ ChainedAttribute ] } description=""/> @@ -200,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -313,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=""/> @@ -321,7 +301,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 +309,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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +CodeBlock } description="The block of code associated with the code object." /> ### comment @@ -34,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; Function | None } description="Returns the constructor method for this class." /> -### constructor_keyword - - } description=" -" /> - ### decorators list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> @@ -67,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -104,19 +94,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Class ] } description="Retrieves the nested classes defined within this class." /> -### node_type - -NodeType } description=" -" /> - ### parameters SymbolGroup [ Parameter , Class ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -128,8 +112,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_classes -Parents[ Type , PyClass ] | None } description=" -" /> +Parents[ Type , Class ] | None } description="The parent classes of this class, if any." /> ### parent_function @@ -145,8 +128,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ Class ] } description="The type of value returned by the callable, or a placeholder." /> ### source @@ -154,18 +136,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Class." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , Class ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -176,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 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=""/> @@ -298,7 +273,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 - + 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=""/> @@ -410,7 +385,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_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_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=""/> @@ -679,7 +654,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=""/> @@ -745,7 +720,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=""/> @@ -753,7 +728,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. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + -list[ Class | ExternalModule | Interface] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> +list[ Class | ExternalModule | TSInterface ] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> ### symbol_usages @@ -989,12 +964,12 @@ Returns a list of symbols that use or import the exportable object. -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -50,11 +46,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -69,27 +60,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### level -int } description=" -" /> +int } description="The indentation level of the code block." /> ### local_var_assignments list[ Assignment [ Editable , CodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_block -CodeBlock | None } description=" -" /> +CodeBlock | None } description="The parent code block containing this block, or None if it is a top-level block." /> ### parent_class @@ -123,11 +106,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -145,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=""/> @@ -234,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -442,7 +420,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=""/> @@ -450,7 +428,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=""/> @@ -458,7 +436,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=""/> @@ -594,7 +572,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 @@ -23,11 +20,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Class ] } description="List of all Classes in the codebase." /> -### console - -Console } description=" -" /> - ### current_commit GitCommit | None } description="Returns the current Git commit that is checked out in the repository." /> @@ -40,6 +32,10 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Directory ] } description="List all directories in the codebase." /> +### exports + +list[ TSExport ] } description="Returns a list of all Export nodes in the codebase." /> + ### external_modules list[ ExternalModule ] } description="Returns a list of all external modules in the codebase." /> @@ -58,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### interfaces -list[TInterface] } description="Retrieves all interfaces in the codebase." /> +list[ TSInterface ] } description="Retrieves all interfaces in the codebase." /> ### language @@ -70,8 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### repo_path -Path } description=" -" /> +Path } description="The path to the repository." /> ### symbols @@ -79,19 +74,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### types -list[ TypeAlias ] } description="List of all Types in the codebase (Typescript only)." /> - -### viz - -VisualizationManager } description=" -" /> +list[ TSTypeAlias ] } description="List of all Types in the codebase (Typescript only)." /> ## Methods ### 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. - + -File } description="The newly created file object."/> +SourceFile } description="The newly created file object."/> ### 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."/> @@ -244,7 +234,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_repo Fetches a codebase from GitHub and returns a Codebase instance. - + +ProgrammingLanguage | None } + description="The programming language of the repo. Defaults to None." + defaultValue="None" +/> @@ -296,7 +292,7 @@ Fetches a codebase from GitHub and returns a Codebase instance. ### 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_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 Commits all staged 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=""/> @@ -545,15 +541,36 @@ Resets the codebase by ### set_ai_key Sets the OpenAI key for the current Codebase instance. - + None } description=""/> ### set_session_options -Sets the Session options for the current codebase. - +Sets the session options for the current codebase. + + + +int, optional } + description="The maximum number of transactions" + defaultValue="" +/> +int, optional } + description="The maximum duration in seconds for a session" + defaultValue="" +/> +int, optional } + description="The maximum number of AI requests" + defaultValue="" +/> + None } description=""/> @@ -561,7 +578,7 @@ 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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ Comment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,20 +74,10 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - ### text str } description="Returns the text content of the comment." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -108,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=""/> @@ -116,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[ Comment ] } description=""/> @@ -222,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,7 +314,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=""/> @@ -343,7 +322,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=""/> @@ -351,7 +330,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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -51,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Return the text content of all comments in the comment block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -142,7 +126,7 @@ Replace the source of this node with new text. ### edit_text Replace the text content of a comment group with new text. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ CommentGroup ] } description=""/> @@ -213,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -326,7 +310,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=""/> @@ -334,7 +318,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=""/> diff --git a/docs/api-reference/core/ComparisonExpression.mdx b/docs/api-reference/core/ComparisonExpression.mdx index 4de1d2368..459eb1685 100644 --- a/docs/api-reference/core/ComparisonExpression.mdx +++ b/docs/api-reference/core/ComparisonExpression.mdx @@ -2,10 +2,7 @@ title: "ComparisonExpression" sidebarTitle: "ComparisonExpression" icon: "" -description: "Any comparison expression in the code. - -Includes all set of `<`, `<=`, `>`, `>=`, `==`, `!=` etc. -" +description: "Any comparison expression in the code. Includes all set of `<`, `<=`, `>`, `>=`, `==`, `!=` etc." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -37,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -52,13 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ ComparisonExpression ] | None } description=" -" /> - -### node_type - -NodeType } description=" -" /> +Expression [ ComparisonExpression ] | None } description="The left operand of the binary expression." /> ### operators @@ -66,8 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -87,18 +72,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ ComparisonExpression ] | None } description=" -" /> +Expression [ ComparisonExpression ] | None } description="The right operand of the binary expression." /> ### source str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -108,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=""/> @@ -116,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=""/> @@ -205,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,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=""/> @@ -326,7 +305,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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -107,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=""/> @@ -204,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,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=""/> @@ -325,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=""/> @@ -333,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) @@ -33,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -46,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -76,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### unpack -Unpack [ TSObjectType ] | None } description=" -" /> +Unpack [ Dict ] | None } description="An optional unpacking element, if present." /> ### variable_usages @@ -95,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=""/> @@ -103,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=""/> @@ -192,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +285,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 +293,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 +301,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 @@ -24,8 +22,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dirpath -str } description=" -" /> +str } description="Relative path of the directory." /> + +### exports + +list[ TSExport ] } description="Get a recursive list of all exports in the directory and its subdirectories." /> ### files @@ -43,10 +44,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ ImportStatement ] } description="Get a recursive list of all import statements in the directory and its subdirectories." /> -### items +### imports -dict[str, File | Directory ] } description=" -" /> +list[ Import ] } description="Get a recursive list of all imports in the directory and its subdirectories." /> ### name @@ -54,13 +54,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Directory | None } description=" -" /> +Directory | None } description="The parent directory, if any." /> ### path -Path } description=" -" /> +Path } description="Absolute path of the directory." /> ### subdirectories @@ -75,7 +73,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_file Add a file to the directory. - + None } description=""/> @@ -83,7 +81,7 @@ Add a file to the directory. ### add_subdirectory Add a subdirectory to the directory. - + None } description=""/> @@ -91,15 +89,23 @@ Add a subdirectory to the directory. ### get_class Get a class by name in the directory and its subdirectories. - + Class | None } description=""/> +### get_export +Get an export by name in the directory and its subdirectories (supports only typescript). + + + +TSExport | None } description=""/> + + ### get_file Get a file by its name relative to the directory. - + File | None } description=""/> @@ -107,7 +113,7 @@ Get a file by its name relative to the directory. ### get_function Get a function by name in the directory and its subdirectories. - + Function | None } description=""/> @@ -115,15 +121,23 @@ Get a function by name in the directory and its subdirectories. ### get_global_var Get a global variable by name in the directory and its subdirectories. - + Assignment | None } description=""/> +### get_import +Get an import by name in the directory and its subdirectories. + + + +Import | None } description=""/> + + ### get_import_statement Get an import statement by name in the directory and its subdirectories. - + ImportStatement | None } description=""/> @@ -131,7 +145,7 @@ Get an import statement by name in the directory and its subdirectories. ### get_subdirectory Get a subdirectory by its path relative to the directory. - + Directory | None } description=""/> @@ -139,7 +153,7 @@ Get a subdirectory by its path relative to the directory. ### get_symbol Get a symbol by name in the directory and its subdirectories. - + Symbol | None } description=""/> @@ -147,7 +161,7 @@ Get a symbol by name in the directory and its subdirectories. ### remove Remove the directory and all its files and subdirectories. - + None } description=""/> @@ -155,7 +169,7 @@ Remove the directory and all its files and subdirectories. ### remove_file Remove a file from the directory. - + None } description=""/> @@ -163,7 +177,7 @@ Remove a file from the directory. ### remove_file_by_path Remove a file from the directory by its path. - + None } description=""/> @@ -171,7 +185,7 @@ Remove a file from the directory by its path. ### remove_subdirectory Remove a subdirectory from the directory. - + None } description=""/> @@ -179,7 +193,7 @@ Remove a subdirectory from the directory. ### remove_subdirectory_by_path Remove a subdirectory from the directory by its path. - + None } description=""/> @@ -187,7 +201,7 @@ Remove a subdirectory from the directory by its path. ### rename Rename the directory. - + None } description=""/> @@ -195,7 +209,7 @@ Rename the directory. ### update_filepath Update the filepath of the directory. - + None } description=""/> diff --git a/docs/api-reference/core/Editable.mdx b/docs/api-reference/core/Editable.mdx index 5ec1cbbe6..9d9754728 100644 --- a/docs/api-reference/core/Editable.mdx +++ b/docs/api-reference/core/Editable.mdx @@ -2,11 +2,7 @@ title: "Editable" sidebarTitle: "Editable" icon: "" -description: "An editable instance is an abstract text representation of any text in a file. - -The editable APIs enables text search and edit within the given Editable wrapper around any -group of text in a file. -" +description: "An editable instance is an abstract text representation of any text in a file." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -15,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -32,11 +28,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -45,15 +36,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -71,11 +56,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -85,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=""/> @@ -93,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=""/> @@ -182,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -295,7 +275,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=""/> @@ -303,7 +283,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=""/> @@ -311,7 +291,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) @@ -24,12 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### export_statement -ExportStatement } description=" -" /> +ExportStatement } description="The statement representing the export." /> ### exported_name @@ -51,11 +50,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -80,15 +74,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -114,11 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -128,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=""/> @@ -136,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`. - + 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=""/> @@ -225,7 +208,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. - + ImportType } + type={ <>ImportType } description="Type of import to generate." defaultValue="ImportType.UNKNOWN" /> @@ -268,7 +251,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."/> @@ -381,7 +364,7 @@ Determines if the Export object is aliased. ### 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."/> @@ -389,7 +372,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."/> @@ -397,7 +380,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=""/> @@ -405,7 +388,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=""/> @@ -413,7 +396,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=""/> @@ -421,7 +404,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -25,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### exports -Collection[ Export , ExportStatement ] } description="A list of the individual exports this statement represents" /> +Collection[ TSExport , ExportStatement ] } description="A list of the individual exports this statement represents" /> ### extended @@ -39,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -64,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ ExportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -98,16 +82,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -117,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=""/> @@ -125,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=""/> @@ -214,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -327,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=""/> @@ -335,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=""/> @@ -343,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 [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) @@ -26,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -44,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -73,15 +66,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -103,11 +90,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -117,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=""/> @@ -125,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[ Exportable ] } description=""/> @@ -214,7 +196,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. - + ImportType } + type={ <>ImportType } description="Type of import to generate." defaultValue="ImportType.UNKNOWN" /> @@ -257,7 +239,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -370,7 +352,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 +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=""/> @@ -386,7 +368,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -43,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -73,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -87,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=""/> @@ -95,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=""/> @@ -184,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +281,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 +289,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 +297,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) @@ -34,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -188,7 +172,7 @@ 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=""/> @@ -196,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,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=""/> @@ -317,7 +301,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=""/> diff --git a/docs/api-reference/core/ExpressionStatement.mdx b/docs/api-reference/core/ExpressionStatement.mdx index ee91ea5ca..10d65afe7 100644 --- a/docs/api-reference/core/ExpressionStatement.mdx +++ b/docs/api-reference/core/ExpressionStatement.mdx @@ -2,22 +2,7 @@ title: "ExpressionStatement" sidebarTitle: "ExpressionStatement" icon: "" -description: "Abstract representation of any expression statements that resolves to an expression. In some -languages without a statement delimiter, expression statement and the enclosed expression looks -the same in text. - -For example, in Python: -```python -x = 1 -``` -The above code is an expression statement, but its expression value is an assignment. - -In Typescript: -```typescript -x = 1; -``` -The above code is also an expression statement, but its expression value is an assignment excluding the semicolon. -" +description: "Abstract representation of any expression statements that resolves to an expression. In some languages without a statement delimiter, expression statement and the enclosed expression looks the same in text. For example, in Python: ```python x = 1 ``` The above code is an expression statement, but its expression value is an assignment. In Typescript: ```typescript x = 1; ``` The above code is also an expression statement, but its expression value is an assignment excluding the semicolon." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -45,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -70,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ ExpressionStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -100,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -123,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=""/> @@ -131,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=""/> @@ -220,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -333,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=""/> @@ -341,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=""/> @@ -349,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 [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) @@ -43,11 +38,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; None } description="File property for ExternalModule class." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="Returns the filepath of the module." /> @@ -64,19 +54,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.EXTERNAL] } description=" -" /> - ### parameters list[ Parameter ] } description="Returns list of named parameters from an external function symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -96,18 +80,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ ExternalModule ] } description="The type of value returned by the callable, or a placeholder." /> ### source str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -117,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=""/> @@ -125,7 +103,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[ ExternalModule ] } description=""/> @@ -214,7 +192,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. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -274,7 +252,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -438,7 +416,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=""/> @@ -446,7 +424,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=""/> @@ -454,7 +432,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -45,15 +42,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; File } description="A property that returns the file object for non-source files." /> -### file_node_id - -NodeId } description=" -" /> - ### file_path -str } description=" -" /> +str } description="The relative file path as a string." /> ### filepath @@ -69,13 +60,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### name -str } description=" -" /> - -### node_type - -Literal[NodeType.FILE] } description=" -" /> +str } description="The name of the file." /> ### owners @@ -83,8 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -100,8 +84,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### path -Path } description=" -" /> +Path } description="The absolute path of the file as a Path object." /> ### source @@ -111,11 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; int } description="Returns the starting byte position of a file in its content." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -125,15 +103,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> ### edit -Replace the source of this `Editable` with `new_src`. - +Replace the source of this file with new_src. + bool } - description="If True, adjusts the indentation of `new_src` to match the current text's indentation level. Defaults to False." + description="If True, adjusts the indentation of new_src to match the current" defaultValue="False" /> int } - description="The priority of the edit transaction. Higher priority edits are applied first. Defaults to 0." + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> 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=""/> @@ -222,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,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=""/> @@ -343,7 +321,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=""/> @@ -368,7 +346,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -376,7 +354,7 @@ Removes the file from the file system and graph. ### rename Renames the file to the specified name, preserving the file extension. - + replace -Search and replace occurrences of text within this node's source and its extended nodes. - +Replace occurrences of text in the file. + str } - description="The text or pattern to search for." + description="The text to be replaced." defaultValue="" /> str } - description="The text to replace matches with." + description="The text to replace with." defaultValue="" /> int, optional } - description="Maximum number of replacements to make. Defaults to -1 (replace all)." + type={ int } + description="Maximum number of replacements to make. -1 means replace all occurrences." defaultValue="-1" /> bool, optional } - description="Whether to treat 'old' as a regex pattern. Defaults to False." + type={ bool } + description="If True, treat 'old' as a regular expression pattern." defaultValue="False" /> int, optional } - description="Priority of the replacement operation. Defaults to 0." + type={ int } + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> -int } description="The total number of replacements made."/> +int } description="List of affected Editable objects. For non-source files, always returns an empty list since they don't have Editable sub-components."/> ### 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. - + + ### 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) @@ -24,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +CodeBlock } description="The block of code associated with the code object." /> ### decorators @@ -46,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -69,13 +60,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### item -Expression [ ForLoopStatement ] | None } description=" -" /> +Expression [ ForLoopStatement ] | None } description="The item being iterated over, if applicable." /> ### iterable -Expression [ ForLoopStatement ] } description=" -" /> +Expression [ ForLoopStatement ] } description="The iterable expression that the loop iterates over." /> ### nested_code_blocks @@ -85,15 +74,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ ForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -115,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -134,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=""/> @@ -165,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=""/> @@ -254,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -367,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=""/> @@ -375,7 +348,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=""/> @@ -383,7 +356,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) @@ -28,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +CodeBlock } description="The block of code associated with the code object." /> ### comment @@ -62,11 +58,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -131,19 +122,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parameters SymbolGroup [ Parameter , Function ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -167,8 +152,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ Function ] } description="The type of value returned by the callable, or a placeholder." /> ### source @@ -176,18 +160,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Function." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , Function ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -198,7 +175,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=""/> @@ -280,7 +257,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -288,7 +265,7 @@ Modifies the function to be asynchronous. ### 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=""/> @@ -385,7 +362,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -578,7 +555,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=""/> @@ -615,7 +592,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=""/> @@ -640,7 +617,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_return_type Sets the return type annotation for the function. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -47,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -80,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -114,11 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Gets the source code representation of this FunctionCall." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -128,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=""/> @@ -136,7 +115,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=""/> @@ -144,7 +123,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=""/> @@ -250,7 +229,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_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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -428,7 +407,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 +415,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=""/> @@ -444,7 +423,7 @@ Reduces an editable to the following condition ### remove Removes a node and optionally its related extended nodes. - + 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. - + + ### 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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -51,19 +46,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parameters Collection[ Type , GenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -107,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=""/> @@ -204,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,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=""/> @@ -325,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=""/> @@ -333,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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +CodeBlock } description="The block of code associated with the code object." /> ### decorators @@ -42,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -59,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; bool } description="Check if the symbol has decorators." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -89,11 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -134,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=""/> @@ -223,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -336,7 +320,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=""/> @@ -344,7 +328,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 +336,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) @@ -37,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### condition -Expression [ PyIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> +Expression [ IfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> ### consequence_block @@ -59,11 +46,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -96,15 +78,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ IfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -126,16 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -145,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=""/> @@ -153,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."/> @@ -196,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=""/> @@ -250,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -363,7 +329,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=""/> @@ -371,7 +337,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) @@ -34,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" -" /> +Editable | None } description="The alias of the imported symbol, if one exists." /> ### dependencies @@ -53,11 +38,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -80,12 +60,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statement -ImportStatement } description="the ImportStatement that this import belongs to" /> +ImportStatement } description="The statement that this import is part of." /> ### import_type -ImportType } description=" -" /> +ImportType } description="The type of import, indicating how the symbol is imported." /> ### imported_exports @@ -95,10 +74,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +### is_dynamic + +bool } description="Determines if this import is dynamically loaded based on its parent symbol." /> + ### module -Editable | None } description=" -" /> +Editable | None } description="The module from which the symbol is being imported, if applicable." /> ### name @@ -108,15 +90,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Returns the namespace prefix that must be used with dot notation to reference the" /> -### node_type - -Literal[NodeType.IMPORT] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -152,13 +128,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### to_file_id -NodeId } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +NodeId } description="The node ID of the file to which this import belongs." /> ### variable_usages @@ -169,7 +139,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=""/> @@ -177,7 +147,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[ Import ] } description=""/> @@ -274,7 +244,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."/> @@ -387,7 +357,7 @@ Returns True if this import is aliased. ### 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."/> @@ -395,7 +365,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."/> @@ -403,7 +373,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."/> @@ -411,7 +381,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."/> @@ -419,7 +389,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=""/> @@ -427,7 +397,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 +405,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=""/> @@ -443,7 +413,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -50,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ Import , ImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -64,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ ImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -94,16 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -113,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=""/> @@ -121,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=""/> @@ -210,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -323,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=""/> @@ -331,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=""/> @@ -339,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(). - + + ## Attributes diff --git a/docs/api-reference/core/Importable.mdx b/docs/api-reference/core/Importable.mdx index 8597ce158..c27462320 100644 --- a/docs/api-reference/core/Importable.mdx +++ b/docs/api-reference/core/Importable.mdx @@ -2,10 +2,7 @@ title: "Importable" sidebarTitle: "Importable" icon: "" -description: "An interface for any node object that can import (or reference) an exportable symbol eg. All nodes that are on the graph must inherit from here - -Class, function, imports, exports, etc. -" +description: "An interface for any node object that can import (or reference) an exportable symbol eg. All nodes that are on the graph must inherit from here Class, function, imports, exports, etc." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -14,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) @@ -37,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -58,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -88,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -102,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=""/> @@ -110,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[ Importable ] } description=""/> @@ -207,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -320,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=""/> @@ -328,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=""/> @@ -336,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 +[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) + +## Attributes + +### attributes + +list[ Attribute ] } description="List of attributes defined in this Interface." /> + +### code_block + +CodeBlock } description="The block of code associated with the code object." /> + +### comment + +CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> + +### decorators + +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> + +### dependencies + +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> + +### docstring + +CommentGroup | None } description="Retrieves the docstring of the expression." /> + +### extended + +SymbolGroup } description="Returns a SymbolGroup of all extended nodes associated with this element." /> + +### extended_nodes + +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> + +### extended_source + +str } description="Returns the source text representation of all extended nodes." /> + +### file + +SourceFile } description="The file object that this Editable instance belongs to." /> + +### filepath + +str } description="The file path of the file that this Editable instance belongs to." /> + +### full_name + +str | None } description="Returns the full name of the object, including the namespace path." /> + +### function_calls + +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> + +### inline_comment + +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> + +### is_decorated + +bool } description="Check if the symbol has decorators." /> + +### name + +str | None } description="Retrieves the base name of the object without namespace prefixes." /> + +### parent + +Editable } description="The parent node of this Editable instance." /> + +### parent_class + +Class | None } description="Find the class this node is contained in" /> + +### parent_function + +Function | None } description="Find the function this node is contained in" /> + +### parent_interfaces + +Parents[ Type , Interface ] | None } description="All the interfaces that this interface extends." /> + +### parent_statement + +Statement | None } description="Find the statement this node is contained in" /> + +### resolved_value + +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> + +### source + +str } description="Returns the source code of the symbol." /> + +### symbol_type + + } description="The type of the symbol." /> + +### type_parameters + +TypeParameters[ Type , Interface ] | None } description="The type parameters of the symbol, if any." /> + +### variable_usages + +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> + + +## Methods + +### add_comment +Adds a comment to the symbol. + + + +str } + description="The comment text to add." + defaultValue="" +/> + + + +None } description=""/> + + +### add_decorator +Adds a decorator to a function or method. + + + +str } + description="The decorator to add, including the '@' symbol." + defaultValue="" +/> +bool, optional } + description="If True, skips adding if the decorator exists." + defaultValue="False" +/> + + + +bool } description="True if the decorator was added, False if skipped."/> + + +### add_keyword +Insert a keyword in the appropriate place before this symbol if it doesn't already exist. + + + +str } + description="The keyword to be inserted. Must be a valid keyword in the language context." + defaultValue="" +/> + + + +None } description=""/> + + +### ancestors +Find all ancestors of the node of the given type. Does not return itself + + + +list[ Editable ] } description=""/> + + +### edit +Replace the source of this node with new_src. + + + +str } + description="The new source code to replace the current source with." + defaultValue="" +/> +bool } + description="If True, adjusts the indentation of new_src to match the current text's indentation. Defaults to False." + defaultValue="False" +/> +int } + description="The priority of this edit. Higher priority edits take precedence. Defaults to 0." + defaultValue="0" +/> +bool } + description="If True, prevents duplicate edits. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + +### extends +Returns True if the interface implements the given parent interface. + + + +bool } description=""/> + + +### find +Find and return matching nodes or substrings within an Editable instance. + + + +Union[list[str], str] } + description="One or more strings to search for." + defaultValue="" +/> +bool } + description="If True, only return nodes whose source exactly matches one of the strings_to_match." + defaultValue="False" +/> + + + +list[ Editable ] } description="A list of Editable instances that match the search criteria."/> + + +### find_string_literals +Returns a list of string literals within this node's source that match any of the given + + + +list[str] } + description="A list of strings to search for in string literals." + defaultValue="" +/> +bool } + description="If True, matches substrings within string literals. If False, only matches exact strings. Defaults to False." + defaultValue="False" +/> + + + +list[ Editable ] } description="A list of Editable objects representing the matching string literals."/> + + +### flag +Adds a visual flag comment to the end of this Editable's source text. + + + +CodeFlag[ Interface ] } description=""/> + + +### get_attribute +Returns the attribute with the given name, if it exists. + + + +Attribute | None } description=""/> + + +### 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."/> + + +### get_variable_usages +Returns Editables for all TreeSitter nodes corresponding to instances of variable usage + + + +str } + description="The variable name to search for." + defaultValue="" +/> +bool } + description="If True, matches variables where var_name is a substring. If False, requires exact match. Defaults to False." + defaultValue="False" +/> + + + +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> + + +### implementations +Returns all classes and interfaces that implement a given interface. + + + +list[ TSInterface | Class ] } description=""/> + + +### insert_after +Inserts code after this node. + + + +str } + description="The source code to insert after this node." + defaultValue="" +/> +bool, optional } + description="Whether to adjust the indentation of new_src to match the current node. Defaults to False." + defaultValue="False" +/> +bool, optional } + description="Whether to add a newline before the new_src. Defaults to True." + defaultValue="True" +/> +int, optional } + description="Priority of the insertion transaction. Defaults to 0." + defaultValue="0" +/> +bool, optional } + description="Whether to deduplicate identical transactions. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + +### insert_before +Inserts text before the current symbol node in the Abstract Syntax Tree. + + + +str } + description="The source code text to insert." + defaultValue="" +/> +bool } + description="Whether to adjust the indentation of new_src to match current text. Defaults to False." + defaultValue="False" +/> +bool } + description="Whether to add a newline after insertion. Defaults to True." + defaultValue="True" +/> +int } + description="Priority of this edit operation. Higher priority edits are applied first. Defaults to 0." + defaultValue="0" +/> +bool } + description="Whether to remove duplicate insertions. Defaults to True." + defaultValue="True" +/> +bool } + description="Whether to insert before extended nodes like comments and decorators. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + +### is_wrapped_in +Check if this node is contained another node of the given class + + + +bool } description=""/> + + +### move_to_file +Moves the given symbol to a new file and updates its imports and references. + + + +SourceFile } + description="The destination file to move the symbol to." + defaultValue="" +/> +bool } + description="If True, moves all dependencies of the symbol to the new file. If False, adds imports for the dependencies. Defaults to True." + defaultValue="True" +/> +str } + description="The strategy to use for updating imports. Can be either 'add_back_edge' or 'update_all_imports'. Defaults to 'update_all_imports'." + defaultValue=""update_all_imports"" +/> + + + +None } description=""/> + + +### parent_of_type +Find the first ancestor of the node of the given type. Does not return itself + + + +Editable | None } description=""/> + + +### reduce_condition +Reduces an editable to the following condition + + + +None } description=""/> + + +### remove +Deletes this Node and its related extended nodes (e.g. decorators, comments). + + + +bool } + description="Whether to delete surrounding whitespace and formatting. Defaults to True." + defaultValue="True" +/> +int } + description="Priority of the removal transaction. Higher priority transactions are executed first. Defaults to 0." + defaultValue="0" +/> +bool } + description="Whether to deduplicate removal transactions at the same location. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + +### rename +Renames a symbol and updates all its references in the codebase. + + + +str } + description="The new name for the symbol." + defaultValue="" +/> +int } + description="Priority of the edit operation. Defaults to 0." + defaultValue="0" +/> + + + +tuple[NodeId, NodeId] } description="A tuple containing the file node ID and the new node ID of the renamed symbol."/> + + +### replace +Search and replace occurrences of text within this node's source and its extended nodes. + + + +str } + description="The text or pattern to search for." + defaultValue="" +/> +str } + description="The text to replace matches with." + defaultValue="" +/> +int, optional } + description="Maximum number of replacements to make. Defaults to -1 (replace all)." + defaultValue="-1" +/> +bool, optional } + description="Whether to treat 'old' as a regex pattern. Defaults to False." + defaultValue="False" +/> +int, optional } + description="Priority of the replacement operation. Defaults to 0." + defaultValue="0" +/> + + + +int } description="The total number of replacements made."/> + + +### search +Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). + + + +str } + description="The regular expression pattern to search for." + defaultValue="" +/> +bool } + description="When False, excludes the contents of string literals from the search. Defaults to True." + defaultValue="True" +/> +bool } + description="When False, excludes the contents of comments from the search. Defaults to True." + defaultValue="True" +/> + + + +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> + + +### set_comment +Sets a comment to the symbol. + + + +str } + description="The comment text to set." + defaultValue="" +/> + + + +None } description=""/> + + +### set_docstring +Sets or updates the docstring for the current entity. + + + +str } + description="The new docstring content to set." + defaultValue="" +/> + + + +None } description="This method doesn't return anything."/> + + +### set_inline_comment +Sets an inline comment to the symbol. + + + +str } + description="The text of the inline comment to be added or updated." + defaultValue="" +/> + + + +None } description=""/> + + +### set_name +Sets the name of a code element. + + + +str } + description="The new name to set for the object." + defaultValue="" +/> + + + +None } description=""/> + + +### symbol_usages +Returns a list of symbols that use or import the exportable object. + + + +UsageType | None } + description="The types of usages to search for. Defaults to any." + defaultValue="None" +/> + + + +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> + + +### usages +Returns a list of usages of the exportable object. + + + +UsageType | None } + description="Specifies which types of usages to include in the results. Default is any usages." + defaultValue="None" +/> + + + +list[ Usage ] } description="A sorted list of Usage objects representing where this exportable is used, ordered by source location in reverse."/> + + + diff --git a/docs/api-reference/core/List.mdx b/docs/api-reference/core/List.mdx index 47bb450e9..7299b6ccd 100644 --- a/docs/api-reference/core/List.mdx +++ b/docs/api-reference/core/List.mdx @@ -2,10 +2,7 @@ title: "List" sidebarTitle: "List" icon: "" -description: "A list object. - -You can use standard operations to operate on this list (IE len, del, append, insert, etc) -" +description: "A list object. You can use standard operations to operate on this list (IE len, del, append, insert, etc)" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -33,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -46,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -80,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -94,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=""/> @@ -110,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=""/> @@ -164,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 - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +274,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 +282,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=""/> @@ -326,7 +307,7 @@ 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 [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### expressions -list[ Expression ] } description=" -" /> +list[ Expression ] } description="A list of expressions contained within the MultiExpression." /> ### extended @@ -35,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -48,15 +42,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -78,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -92,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=""/> @@ -100,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=""/> @@ -189,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,7 +285,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=""/> @@ -310,7 +293,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=""/> @@ -318,7 +301,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) @@ -34,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -161,7 +141,7 @@ 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=""/> @@ -169,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -298,7 +278,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=""/> @@ -306,7 +286,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=""/> diff --git a/docs/api-reference/core/Name.mdx b/docs/api-reference/core/Name.mdx index b7e77a001..ba1cdef98 100644 --- a/docs/api-reference/core/Name.mdx +++ b/docs/api-reference/core/Name.mdx @@ -2,11 +2,7 @@ title: "Name" sidebarTitle: "Name" icon: "" -description: "Editable attribute on any given code objects that has a name. - -For example, function, classes, global variable, interfaces, attributes, parameters are all -composed of a name. -" +description: "Editable attribute on any given code objects that has a name. For example, function, classes, global variable, interfaces, attributes, parameters are all composed of a name." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -34,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -47,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -77,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -91,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=""/> @@ -99,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=""/> @@ -188,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +281,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 +289,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 +297,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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -51,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -81,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -95,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=""/> @@ -103,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=""/> @@ -200,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -313,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=""/> @@ -321,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=""/> @@ -329,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 [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -43,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -73,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -87,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=""/> @@ -95,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=""/> @@ -184,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +281,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 +289,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 +297,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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -46,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -76,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -90,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=""/> @@ -98,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=""/> @@ -187,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,7 +281,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=""/> @@ -308,7 +289,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=""/> @@ -316,7 +297,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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -45,22 +40,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### key -Expression } description=" -" /> +Expression } description="The key expression of the pair, expected to be of type TExpression." /> ### name str } description="Returns the source text of the key expression in the pair." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -78,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -96,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=""/> @@ -104,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=""/> @@ -193,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -306,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=""/> @@ -314,7 +297,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=""/> @@ -322,7 +305,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), [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) @@ -38,11 +38,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -75,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -105,14 +94,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ Parameter ] } description="The type annotation associated with this node" /> ### value @@ -127,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=""/> @@ -135,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`. - + 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=""/> @@ -232,7 +216,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -345,7 +329,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=""/> @@ -353,7 +337,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=""/> @@ -361,7 +345,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_type_annotation Sets the type annotation for this parameter. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -49,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Retrieves a list of function calls within a parenthesized expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -79,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -97,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=""/> @@ -105,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=""/> @@ -194,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -307,7 +285,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=""/> @@ -338,7 +316,7 @@ 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. - + 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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -43,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -73,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -87,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=""/> @@ -95,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=""/> @@ -184,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +281,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 +289,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 +297,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) @@ -36,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -61,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ RaiseStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -91,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -114,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=""/> @@ -122,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=""/> @@ -211,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -324,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=""/> @@ -332,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=""/> @@ -340,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) @@ -39,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -64,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ ReturnStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -94,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -117,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=""/> @@ -125,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=""/> @@ -214,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -327,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=""/> @@ -335,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=""/> @@ -343,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), [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) @@ -28,8 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +CodeBlock } description="Represents the block of code contained in the file." /> ### content @@ -67,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="A property that returns the file object for non-source files." /> -### file_node_id - -NodeId } description=" -" /> - ### file_path -str } description=" -" /> +str } description="The relative file path as a string." /> ### filepath @@ -129,19 +118,13 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.FILE] } description=" -" /> - ### owners set[str] } description="Returns the CODEOWNERS of the file." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -157,8 +140,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### path -Path } description=" -" /> +Path } description="The absolute path of the file as a Path object." /> ### resolved_value @@ -176,11 +158,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -190,7 +167,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + add_import_from_import_string Adds import to the file from a string representation of an import statement. - + add_symbol Adds `symbol` to the file. - + add_symbol_from_source Adds a symbol to a file from a string representation. - + add_symbol_import Adds an import to a file for a given symbol. - + ImportType } + type={ <>ImportType } description="The type of import to use. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -305,15 +282,15 @@ Adds an import to a file for a given symbol. ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> ### edit -Replace the source of this `Editable` with `new_src`. - +Replace the source of this file with new_src. + bool } - description="If True, adjusts the indentation of `new_src` to match the current text's indentation level. Defaults to False." + description="If True, adjusts the indentation of new_src to match the current" defaultValue="False" /> int } - description="The priority of the edit transaction. Higher priority edits are applied first. Defaults to 0." + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> 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=""/> @@ -419,7 +396,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_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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -642,7 +619,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=""/> @@ -650,7 +627,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=""/> @@ -658,7 +635,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -666,7 +643,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -674,7 +651,7 @@ Removes unused exports from the file. ### 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. - +Replace occurrences of text in the file. + str } - description="The text or pattern to search for." + description="The text to be replaced." defaultValue="" /> str } - description="The text to replace matches with." + description="The text to replace with." defaultValue="" /> int, optional } - description="Maximum number of replacements to make. Defaults to -1 (replace all)." + type={ int } + description="Maximum number of replacements to make. -1 means replace all occurrences." defaultValue="-1" /> bool, optional } - description="Whether to treat 'old' as a regex pattern. Defaults to False." + type={ bool } + description="If True, treat 'old' as a regular expression pattern." defaultValue="False" /> int, optional } - description="Priority of the replacement operation. Defaults to 0." + type={ int } + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> -int } description="The total number of replacements made."/> +int } description="List of affected Editable objects. For non-source files, always returns an empty list since they don't have Editable sub-components."/> ### 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. - + symbol_can_be_added Checks if the file type supports adding the given symbol. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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 | TInterface] } 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"/> +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"/> ### 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 ### filepath -str } description=" -" /> - -### model_config - - } description=" -" /> +str } description="The path to the file associated with the range." /> ### range -RangeAdapter } description=" -" /> +RangeAdapter } description="Adapter for the range within the codebase." /> diff --git a/docs/api-reference/core/Statement.mdx b/docs/api-reference/core/Statement.mdx index e1731c449..7f5c53a57 100644 --- a/docs/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) @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ Statement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -104,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=""/> @@ -112,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=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,7 +301,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=""/> @@ -330,7 +309,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 ### ASSIGNMENT - } description=" -" /> + } description="Represents an assignment expression." /> ### BREAK_STATEMENT - } description=" -" /> + } description="Represents a break statement." /> ### CLASS_ATTRIBUTE - } description=" -" /> + } description="Represents a class attribute." /> ### COMMENT - } description=" -" /> + } description="Represents a comment statement." /> ### EXPORT_STATEMENT - } description=" -" /> + } description="Represents an export statement." /> ### EXPRESSION_STATEMENT - } description=" -" /> + } description="Represents an expression statement." /> ### FOR_LOOP_STATEMENT - } description=" -" /> + } description="Represents a for loop statement." /> ### IF_BLOCK_STATEMENT - } description=" -" /> + } description="Represents an if block statement." /> ### IMPORT_STATEMENT - } description=" -" /> + } description="Represents an import statement." /> ### LABELED_STATEMENT - } description=" -" /> + } description="Represents a labeled statement." /> ### PASS_STATEMENT - } description=" -" /> + } description="Represents a pass statement." /> ### RAISE_STATEMENT - } description=" -" /> + } description="Represents a raise statement." /> ### RETURN_STATEMENT - } description=" -" /> + } description="Represents a return statement." /> ### SWITCH_STATEMENT - } description=" -" /> + } description="Represents a switch statement." /> ### SYMBOL_STATEMENT - } description=" -" /> + } description="Represents a symbol statement." /> ### TRY_CATCH_STATEMENT - } description=" -" /> + } description="Represents a try-catch statement." /> ### UNSPECIFIED - } description=" -" /> + } description="Represents any unparsed code snippet or graph node statements." /> ### WHILE_STATEMENT - } description=" -" /> + } description="Represents a while statement." /> ### WITH_STATEMENT - } description=" -" /> + } description="Represents a with statement." /> diff --git a/docs/api-reference/core/String.mdx b/docs/api-reference/core/String.mdx index 524a4eb69..b39dd7ea4 100644 --- a/docs/api-reference/core/String.mdx +++ b/docs/api-reference/core/String.mdx @@ -2,12 +2,7 @@ title: "String" sidebarTitle: "String" icon: "" -description: "GraphSitter representation of String. - -Attributes: -content: The content of the string -expressions: embedded expressions in the string, only applicable for templated or formatted strings -" +description: "GraphSitter representation of String." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -16,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) @@ -29,12 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" -" /> +Collection[ Expression [ Editable ], String ] } description="A collection of string fragments and escape sequences in TS, or a single string content in Python." /> ### expressions -list[ Expression [ Editable ]] } description="embedded expressions in the string, only applicable for templated or formatted strings" /> +list[ Expression [ Editable ]] } description="Embedded expressions in the string, only applicable for templated or formatted strings." /> ### extended @@ -48,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -61,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -91,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -109,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=""/> @@ -117,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=""/> @@ -206,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -319,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=""/> @@ -327,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=""/> @@ -335,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 [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the source code of this placeholder node. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -34,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -49,23 +40,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### indices -list[ Expression ] } description=" -" /> - -### node_type - -NodeType } description=" -" /> +list[ Expression ] } description="A list of indices used for indexing the object." /> ### object -Object } description=" -" /> +Object } description="The object being indexed." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -87,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -101,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=""/> @@ -109,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=""/> @@ -198,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -311,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=""/> @@ -319,7 +297,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=""/> @@ -327,7 +305,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(). - + ### code_block -CodeBlock | None } description=" -" /> +CodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition -Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> +Expression [ SwitchCase ] | None } description="The condition which triggers this case" /> ### decorators @@ -52,11 +46,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -81,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ SwitchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -111,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -130,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=""/> @@ -161,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=""/> @@ -250,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -363,7 +336,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=""/> @@ -371,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=""/> @@ -379,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. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### cases -list[ SwitchCase ] } description=" -" /> +list[ SwitchCase ] } description="A list of switch cases." /> ### extended @@ -39,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -64,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ SwitchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -94,19 +78,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ SwitchStatement ] } description="The value to switch on." /> ### variable_usages @@ -117,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=""/> @@ -125,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=""/> @@ -214,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -327,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=""/> @@ -335,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=""/> @@ -343,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 [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) @@ -45,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -70,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -102,13 +88,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type -SymbolType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +SymbolType } description="The type of the symbol." /> ### variable_usages @@ -119,7 +99,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=""/> @@ -161,7 +141,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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=""/> @@ -258,7 +238,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -377,7 +357,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=""/> @@ -414,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=""/> @@ -422,7 +402,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -53,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -83,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -97,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=""/> @@ -186,7 +168,7 @@ 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=""/> @@ -194,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -307,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=""/> @@ -315,7 +297,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=""/> diff --git a/docs/api-reference/core/SymbolStatement.mdx b/docs/api-reference/core/SymbolStatement.mdx index d5d81bf40..b71c780e3 100644 --- a/docs/api-reference/core/SymbolStatement.mdx +++ b/docs/api-reference/core/SymbolStatement.mdx @@ -2,11 +2,7 @@ title: "SymbolStatement" sidebarTitle: "SymbolStatement" icon: "" -description: "A statement that represents a symbol definition in a codeblock. - -Examples include: -- a function definition, class definition, global variable assignment -" +description: "A statement that represents a symbol definition in a codeblock. Examples include: - a function definition, class definition, global variable assignment" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -15,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -34,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -59,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ SymbolStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -89,20 +74,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - ### symbol -Editable } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +Editable } description="The symbol associated with this statement, representing a code element." /> ### variable_usages @@ -113,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=""/> @@ -121,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=""/> @@ -210,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -323,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=""/> @@ -331,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=""/> @@ -339,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) @@ -20,18 +20,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TernaryExpression ] | None } description="The expression to execute if the condition is false." /> ### condition -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TernaryExpression ] | None } description="The condition expression that determines which branch to execute." /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TernaryExpression ] | None } description="The expression to execute if the condition is true." /> ### extended @@ -45,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -58,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -88,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -102,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=""/> @@ -110,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=""/> @@ -199,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -312,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=""/> @@ -320,7 +301,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(). - + ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +CodeBlock } description="The block of code associated with the code object." /> ### decorators @@ -47,11 +42,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -80,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -110,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -129,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=""/> @@ -160,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=""/> @@ -249,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -362,7 +336,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=""/> @@ -370,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=""/> @@ -378,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. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -46,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -80,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -94,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=""/> @@ -110,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=""/> @@ -164,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 - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +274,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 +282,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=""/> @@ -326,7 +307,7 @@ 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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -53,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -87,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -101,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=""/> @@ -163,7 +145,7 @@ 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=""/> @@ -171,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,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=""/> @@ -308,7 +290,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=""/> diff --git a/docs/api-reference/core/Type.mdx b/docs/api-reference/core/Type.mdx index 46d42e47c..941051944 100644 --- a/docs/api-reference/core/Type.mdx +++ b/docs/api-reference/core/Type.mdx @@ -2,9 +2,7 @@ title: "Type" sidebarTitle: "Type" icon: "" -description: "Abstract representation of a type -Used to store the types of variables, parameters, or return values in functions, classes, etc. -" +description: "Abstract representation of a type Used to store the types of variables, parameters, or return values in functions, classes, etc." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -32,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -45,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -75,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -89,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=""/> @@ -97,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=""/> @@ -186,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -299,7 +281,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=""/> @@ -307,7 +289,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=""/> @@ -315,7 +297,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) @@ -27,8 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +CodeBlock } description="The code block associated with this type alias." /> ### comment @@ -62,11 +58,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -91,15 +82,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -123,18 +108,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Interface." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , TypeAlias ] | None } description="The type parameters of the symbol, if any." /> ### value @@ -149,7 +127,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=""/> @@ -214,7 +192,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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=""/> @@ -303,7 +281,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Get attribute by name. - + Attribute | None } description=""/> @@ -319,7 +297,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -438,7 +416,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=""/> @@ -475,7 +453,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 +461,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="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) @@ -23,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the type annotation of a placeholder node. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -34,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -51,15 +42,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; bool } description="Indicates if a node has an explicit type annotation." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -77,14 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ Typeable ] } description="The type annotation associated with this node" /> ### variable_usages @@ -95,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=""/> @@ -103,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=""/> @@ -192,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +285,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 +293,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 +301,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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -51,15 +42,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -81,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -95,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=""/> @@ -103,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=""/> @@ -192,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -305,7 +285,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 +310,7 @@ 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(). - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -53,15 +46,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -87,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -101,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=""/> @@ -163,7 +145,7 @@ 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=""/> @@ -171,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,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=""/> @@ -308,7 +290,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=""/> diff --git a/docs/api-reference/core/Unpack.mdx b/docs/api-reference/core/Unpack.mdx index af1ca970c..1f11cb4de 100644 --- a/docs/api-reference/core/Unpack.mdx +++ b/docs/api-reference/core/Unpack.mdx @@ -2,13 +2,7 @@ title: "Unpack" sidebarTitle: "Unpack" icon: "" -description: "Unpacking of an iterable. - -Example: -```python -[a, *b] -``` -" +description: "Unpacking of an iterable. Example: ```python [a, *b] ```" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -17,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), [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -36,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -49,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -79,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -97,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=""/> @@ -105,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=""/> @@ -194,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -307,7 +285,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=""/> @@ -315,7 +293,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=""/> @@ -323,7 +301,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 Unwraps a node's content into its parent node. - + SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -45,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -75,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -89,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=""/> @@ -97,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=""/> @@ -186,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -299,7 +281,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=""/> @@ -307,7 +289,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=""/> @@ -315,7 +297,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 [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -34,11 +34,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -55,15 +50,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -107,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[ Usable ] } description=""/> @@ -204,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,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=""/> @@ -325,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=""/> @@ -333,7 +317,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ Import | Symbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + + ## Attributes ### imported_by -Import | None } description=" -" /> +Import | None } description="The import statement that brought this symbol into scope, or None if not imported" /> ### kind @@ -38,7 +30,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### usage_symbol -Import | Symbol | Export | SourceFile } description="The symbol this object is used in" /> +Import | Symbol | TSExport | SourceFile } description="The symbol this object is used in" /> ### usage_type diff --git a/docs/api-reference/core/UsageKind.mdx b/docs/api-reference/core/UsageKind.mdx index 3048ef120..b701993fa 100644 --- a/docs/api-reference/core/UsageKind.mdx +++ b/docs/api-reference/core/UsageKind.mdx @@ -2,21 +2,7 @@ title: "UsageKind" sidebarTitle: "UsageKind" icon: "" -description: "SymbolUsageType is an enumeration class that defines different types of symbol usage within Python code. - -Attributes: -SUBCLASS: Used in symbol inheritance. -TYPE_ANNOTATION: Used as a type annotation on a parameter or assignment statement. -BODY: Usage within the body of a function/method. -DECORATOR: Usage within a decorator. -RETURN_TYPE: Used as a return type annotation -TYPE_DEFINITION: Used in a type alias. -EXPORTED_SYMBOL: Used in an export statement. -EXPORTED_WILDCARD: Re-exported by a wildcard export. -GENERIC: Used as a type parameter to another type. -IMPORTED: Imported with an import statement. -DEFAULT_VALUE: Represents a default value in a function/method parameter. -" +description: "SymbolUsageType is an enumeration class that defines different types of symbol usage within Python code." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -25,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -60,12 +46,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### IMPORTED_WILDCARD - } description=" -" /> + } description="Imported with a wildcard import statement." /> ### RETURN_TYPE - } description="Used as a return type annotation" /> + } description="Used as a return type annotation." /> ### SUBCLASS @@ -73,12 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### TYPED_PARAMETER - } description=" -" /> + } description="Used as a typed parameter in a function/method." /> ### TYPE_ANNOTATION - } description=" Used as a type annotation on a parameter or assignment statement." /> + } description="Used as a type annotation on a parameter or assignment statement." /> ### TYPE_DEFINITION diff --git a/docs/api-reference/core/UsageType.mdx b/docs/api-reference/core/UsageType.mdx index 3bc3444ed..3859c5838 100644 --- a/docs/api-reference/core/UsageType.mdx +++ b/docs/api-reference/core/UsageType.mdx @@ -2,14 +2,7 @@ title: "UsageType" sidebarTitle: "UsageType" icon: "" -description: "Describes how a symbol is used elsewhere. Used in conjunction with get_usages - -Attributes: -DIRECT: Direct imports and usages within the same file -CHAINED: Chained references (ie: module.foo) -INDIRECT: Indirect usages with the same name -ALIASED: Aliased indirect usages -" +description: "Describes how a symbol is used elsewhere. Used in conjunction with get_usages" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -18,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/api-reference/core/Value.mdx b/docs/api-reference/core/Value.mdx index d87ce0c3f..cbe34f34c 100644 --- a/docs/api-reference/core/Value.mdx +++ b/docs/api-reference/core/Value.mdx @@ -2,12 +2,7 @@ title: "Value" sidebarTitle: "Value" icon: "" -description: "Editable attribute on code objects that has a value. - -For example, Functions, Classes, Assignments, Interfaces, Expressions, Arguments and Parameters all have values. - -See also HasValue. -" +description: "Editable attribute on code objects that has a value. For example, Functions, Classes, Assignments, Interfaces, Expressions, Arguments and Parameters all have values. See also HasValue." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -16,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) @@ -35,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -48,15 +38,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -78,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -92,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=""/> @@ -100,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=""/> @@ -189,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,7 +281,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=""/> @@ -310,7 +289,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=""/> @@ -318,7 +297,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) @@ -20,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +CodeBlock } description="The code block that represents the body of the while statement." /> ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ WhileStatement ] } description="The condition expression of the while statement." /> ### decorators @@ -47,11 +46,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; SourceFile } description="The file object that this Editable instance belongs to." /> -### file_node_id - -NodeId } description=" -" /> - ### filepath str } description="The file path of the file that this Editable instance belongs to." /> @@ -76,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ WhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class @@ -106,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -125,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=""/> @@ -156,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=""/> @@ -245,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -358,7 +336,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=""/> @@ -366,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=""/> @@ -374,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. - + ### clause -ExpressionGroup } description="the expression of the with clause" /> +ExpressionGroup } description="The expression of the with clause." /> ### code_block -PyCodeBlock [ WithStatement ] } description="(PyCodeBlock) the code block of the with statement" /> +PyCodeBlock [ WithStatement ] } description="The code block of the with statement." /> ### decorators @@ -61,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -92,23 +70,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ WithStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -122,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -141,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=""/> @@ -172,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=""/> @@ -261,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -374,7 +336,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=""/> @@ -382,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=""/> @@ -390,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(). - + + ### 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) @@ -27,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -43,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -86,23 +78,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,17 +104,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.GlobalVar." /> ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyAssignment ] } description="The type annotation associated with this node" /> ### value @@ -143,7 +123,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=""/> @@ -203,7 +183,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ PyAssignment ] } description=""/> @@ -292,7 +272,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_named_expression Creates a MultiExpression from a Python named expression. - + get_import_string Generates an import string for a Python symbol. - + ImportType } + type={ <>ImportType } description="Type of import to generate. If WILDCARD, generates star import. Defaults to UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -365,12 +345,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -497,12 +477,12 @@ 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. - + SourceFile } + type={ <>PyFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -526,7 +506,7 @@ 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=""/> @@ -551,7 +531,7 @@ Simplifies an assignment expression by reducing it based on a boolean 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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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) ## Attributes -### assignment_types - - } description=" -" /> - ### assignments -list[ Assignment ] } description=" -" /> +list[ PyAssignment ] } description="A list of assignments within the statement." /> ### extended @@ -43,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -64,8 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ PyAssignment ] } description="The left-hand side expression of the first assignment." /> ### nested_code_blocks @@ -75,23 +58,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -103,23 +80,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ PyAssignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -133,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=""/> @@ -141,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=""/> @@ -230,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -396,7 +362,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=""/> @@ -404,7 +370,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=""/> @@ -412,7 +378,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 [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) @@ -20,22 +20,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignment -Assignment } description=" -" /> - -### assignment_types - - } description=" -" /> +PyAssignment } description="The assignment associated with the attribute." /> ### assignments -list[ Assignment ] } description=" -" /> +list[ PyAssignment ] } description="A list of assignments within the statement." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -47,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -80,8 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ PyAssignment ] } description="The left-hand side expression of the first assignment." /> ### name @@ -95,23 +82,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -123,23 +104,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ PyAssignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -153,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=""/> @@ -161,7 +131,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[ PyAttribute ] } description=""/> @@ -250,7 +220,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. - + -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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -424,7 +394,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."/> @@ -432,7 +402,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=""/> @@ -440,7 +410,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 +418,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_value Sets the value of a node's assignment. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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) @@ -20,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -41,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -66,29 +60,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ PyCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -102,16 +90,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -121,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=""/> @@ -152,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=""/> @@ -241,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -354,7 +332,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=""/> @@ -362,7 +340,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=""/> @@ -370,7 +348,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 [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -28,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyBreakStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -104,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=""/> @@ -112,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=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,7 +301,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=""/> @@ -330,7 +309,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(). - + ### code_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition @@ -50,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -75,29 +64,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ PyCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -111,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -130,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=""/> @@ -161,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=""/> @@ -250,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -363,7 +336,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=""/> @@ -371,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=""/> @@ -379,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(). - + + ### Inherits from [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -22,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attribute -Attribute } description="Gets the attribute being accessed in a chained attribute expression." /> +PyAttribute } description="Gets the attribute being accessed in a chained attribute expression." /> ### extended @@ -34,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -53,27 +46,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### object Object } description="Returns the object that contains the attribute being looked up." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -87,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -101,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=""/> @@ -109,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[ PyChainedAttribute ] } description=""/> @@ -198,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -311,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=""/> @@ -319,7 +301,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=""/> @@ -327,7 +309,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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +PyCodeBlock } description="The block of code associated with the code object." /> ### comment @@ -32,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### constructor -Function | None } description="Returns the constructor method for this class." /> - -### constructor_keyword - - } description=" -" /> +PyFunction | None } description="Returns the constructor method for this class." /> ### decorators @@ -45,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -65,12 +60,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -108,36 +98,29 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ PyClass ] } description="Retrieves the nested classes defined within this class." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parameters -SymbolGroup [ Parameter , PyClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ PyParameter , PyClass ] | list[ PyParameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_class_names -list[ Name | ChainedAttribute ] } description="Returns a list of the parent class names that this class inherits from." /> +list[ Name | PyChainedAttribute ] } description="Returns a list of the parent class names that this class inherits from." /> ### parent_classes -Parents[ Type , PyClass ] | None } description=" -" /> +Parents[ Type , PyClass ] | None } description="The parent classes of this class, if any." /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -149,8 +132,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ PyClass ] } description="The type of value returned by the callable, or a placeholder." /> ### source @@ -158,18 +140,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Class." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , PyClass ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -180,12 +155,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + Attribute } + type={ <>PyAttribute } description="The attribute to add to the class." defaultValue="" /> @@ -203,7 +178,7 @@ 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=""/> @@ -320,7 +295,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 - + -list[ Attribute ] } description="A list of unique attributes from this class and its superclasses. If an attribute is defined in multiple classes, the first definition encountered is used."/> +list[ PyAttribute ] } description="A list of unique attributes from this class and its superclasses. If an attribute is defined in multiple classes, the first definition encountered is used."/> ### 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[ PyClass ] } description=""/> @@ -432,7 +407,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + -Attribute | None } description="The matching attribute if found, None otherwise. If multiple attributes with the same name exist in the inheritance hierarchy, returns the first one found."/> +PyAttribute | None } description="The matching attribute if found, None otherwise. If multiple attributes with the same name exist in the inheritance hierarchy, returns the first one found."/> ### get_import_string Generates an import string for a Python symbol. - + ImportType } + type={ <>ImportType } description="Type of import to generate. If WILDCARD, generates star import. Defaults to UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -484,7 +459,7 @@ Generates an import string for a Python symbol. ### get_method Returns a specific method by name from the class or any of its superclasses. - + -Function | None } description="The method if found, None otherwise."/> +PyFunction | None } description="The method if found, None otherwise."/> ### get_name @@ -504,12 +479,12 @@ 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."/> +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."/> ### 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. - + -Parameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> +PyParameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> ### get_parameter_by_index Returns the parameter at the given index. - + -Parameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> +PyParameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> ### get_parameter_by_type Retrieves a parameter from the callable by its type. - + Symbol } + type={ <>PySymbol } description="The type to search for." defaultValue="" /> -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +PyParameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> ### 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_subclass_of Checks if the class inherits from a specified parent class. - + str | Class } + type={ <>str | PyClass } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" /> @@ -728,7 +703,7 @@ 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=""/> @@ -736,7 +711,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 - + -list[ Function ] | MultiLineCollection [ Function , PyClass ] } description=""/> +list[ PyFunction ] | MultiLineCollection [ PyFunction , PyClass ] } description=""/> ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + SourceFile } + type={ <>PyFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -794,7 +769,7 @@ 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=""/> @@ -802,7 +777,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=""/> @@ -810,7 +785,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. - + subclasses Returns all classes which subclass this class. - + -list[ Class ] } description="A list of Class objects that inherit from this class."/> +list[ PyClass ] } description="A list of Class objects that inherit from this class."/> ### superclasses Returns a list of all classes that this class extends, up to max_depth. - + -list[ Class | ExternalModule | Interface] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> +list[ PyClass | ExternalModule | Interface ] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> ### symbol_usages @@ -1094,12 +1069,12 @@ Returns a list of symbols that use or import the exportable object. -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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) @@ -20,19 +20,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignment_statements -list[ AssignmentStatement [ PyCodeBlock , Assignment ]] } description="Returns list of top level assignment statements in the code block." /> +list[ PyAssignmentStatement [ PyCodeBlock , PyAssignment ]] } description="Returns list of top level assignment statements in the code block." /> ### assignments -list[ Assignment [ Editable , PyCodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> +list[ PyAssignment [ Editable , PyCodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> ### attributes -list[ Attribute [ Editable , PyCodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> +list[ PyAttribute [ Editable , PyCodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> ### comments -list[ Comment [ Editable , PyCodeBlock ]] } description="Gets list of top level comments in the code block." /> +list[ PyComment [ Editable , PyCodeBlock ]] } description="Gets list of top level comments in the code block." /> ### extended @@ -44,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -61,39 +56,31 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### if_blocks -list[ IfBlockStatement [ PyCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> +list[ PyIfBlockStatement [ PyCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> ### level -int } description=" -" /> +int } description="The indentation level of the code block." /> ### local_var_assignments -list[ Assignment [ Editable , PyCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> - -### node_type - -NodeType } description=" -" /> +list[ PyAssignment [ Editable , PyCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The parent code block containing this block, or None if it is a top-level block." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -119,11 +106,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -145,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=""/> @@ -234,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. - + -list[ Assignment [ Editable , PyCodeBlock ]] } description="A list of Assignment objects that match the variable name."/> +list[ PyAssignment [ Editable , PyCodeBlock ]] } description="A list of Assignment objects that match the variable name."/> ### get_attributes Returns attributes from the code block, with the option to include or exclude private - + -list[ Attribute [ Editable , PyCodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> +list[ PyAttribute [ Editable , PyCodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> ### get_comment Gets the first comment statement containing a specific text string. - + -Comment [ Editable , PyCodeBlock ] | None } description="The first comment statement containing the search text, or None if no matching comment is found."/> +PyComment [ Editable , PyCodeBlock ] | None } description="The first comment statement containing the search text, or None if no matching comment is found."/> ### get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + -Assignment [ Editable , PyCodeBlock ] | None } description="The first matching local variable assignment, or None if no match is found."/> +PyAssignment [ Editable , PyCodeBlock ] | None } description="The first matching local variable assignment, or None if no match is found."/> ### get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + -list[ Assignment [ Editable , PyCodeBlock ]] } description="List of Assignment objects representing local variable assignments that match the specified name criteria."/> +list[ PyAssignment [ Editable , PyCodeBlock ]] } description="List of Assignment objects representing local variable assignments that match the specified name criteria."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -459,7 +441,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 +449,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=""/> @@ -475,7 +457,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=""/> @@ -611,7 +593,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) @@ -32,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -57,29 +52,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> +list[ PyCodeBlock ] } description="Returns a list of nested code blocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyComment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -93,20 +82,10 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - ### text str } description="Returns the text content of the comment." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -116,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=""/> @@ -124,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`. - + 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=""/> @@ -247,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -395,7 +374,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=""/> @@ -403,7 +382,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=""/> @@ -411,7 +390,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) @@ -37,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -60,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -94,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Return the text content of all comments in the comment block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -108,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=""/> @@ -151,7 +126,7 @@ Replace the source of this node with new text. ### edit_text Replace the text content of a comment group with new text. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyCommentGroup ] } description=""/> @@ -222,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,7 +310,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=""/> @@ -343,7 +318,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=""/> @@ -444,7 +419,7 @@ Searches for regex matches in the codebase. ### to_google_docstring Convert a comment group into a Google-style docstring. - + + ## Attributes ### MULTI_LINE_DOUBLE_QUOTE - } description=" -" /> + } description="Represents a multi-line comment using double quotes." /> ### MULTI_LINE_QUOTE - } description=" -" /> + } description="Represents a multi-line comment using single quotes." /> ### SINGLE_LINE - } description=" -" /> + } description="Represents a single line comment." /> ### UNKNOWN - } description=" -" /> + } description="Represents an unknown type of comment." /> diff --git a/docs/api-reference/python/PyConditionalExpression.mdx b/docs/api-reference/python/PyConditionalExpression.mdx index 1578a20ab..b92903015 100644 --- a/docs/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) @@ -20,18 +20,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ PyConditionalExpression ] | None } description="The expression to execute if the condition is false." /> ### condition -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ PyConditionalExpression ] | None } description="The condition expression that determines which branch to execute." /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ PyConditionalExpression ] | None } description="The expression to execute if the condition is true." /> ### extended @@ -43,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -58,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -88,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -102,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=""/> @@ -110,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=""/> @@ -199,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -312,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=""/> @@ -320,7 +301,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) @@ -32,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -107,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=""/> @@ -199,12 +183,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,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=""/> @@ -325,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=""/> @@ -333,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 [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) @@ -20,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ Class ] } description="Returns all Classes in the file." /> +list[ PyClass ] } description="Returns all Classes in the file." /> ### code_block -CodeBlock } description=" -" /> +PyCodeBlock } description="Represents the block of code contained in the file." /> ### content @@ -37,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### directory @@ -63,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; PyFile } description="A property that returns the file object for non-source files." /> -### file_node_id - -NodeId } description=" -" /> - ### file_path -str } description=" -" /> +str } description="The relative file path as a string." /> ### filepath @@ -87,11 +80,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### functions -list[ Function ] } description="Returns all Functions in the file." /> +list[ PyFunction ] } description="Returns all Functions in the file." /> ### global_vars -list[ Assignment ] } description="Returns all GlobalVars in the file." /> +list[ PyAssignment ] } description="Returns all GlobalVars in the file." /> ### import_module_name @@ -99,19 +92,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statements -list[ ImportStatement ] } description="Returns all ImportStatements in the file, where each import statement can contain" /> +list[ PyImportStatement ] } description="Returns all ImportStatements in the file, where each import statement can contain" /> ### importers -list[ Import ] } description="Returns all imports that directly imports this file as a module." /> +list[ PyImport ] } description="Returns all imports that directly imports this file as a module." /> ### imports -list[ Import ] } description="List of all Imports in this file." /> +list[ PyImport ] } description="List of all Imports in this file." /> ### inbound_imports -list[ Import ] } description="Returns all imports that are importing symbols contained in this file." /> +list[ PyImport ] } description="Returns all imports that are importing symbols contained in this file." /> ### is_binary @@ -125,27 +118,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.FILE] } description=" -" /> - ### owners set[str] } description="Returns the CODEOWNERS of the file." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -153,13 +140,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### path -Path } description=" -" /> +Path } description="The absolute path of the file as a Path object." /> ### programming_language - } description=" -" /> + } description="The programming language of the file. Set to ProgrammingLanguage.PYTHON." /> ### resolved_value @@ -175,12 +160,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols_sorted_topologically -list[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> - -### ts_node - -TSNode } description=" -" /> +list[ PySymbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> ### variable_usages @@ -191,7 +171,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + add_import_from_import_string Adds an import statement to the file from a string representation. - + add_symbol Adds `symbol` to the file. - + Symbol } + type={ <>PySymbol } description="The symbol to add to the file." defaultValue="" /> @@ -249,12 +229,12 @@ Adds `symbol` to the file. -Symbol | None } description="The existing symbol if it already exists in the file or None if it was added."/> +PySymbol | None } description="The existing symbol if it already exists in the file or None if it was added."/> ### add_symbol_from_source Adds a symbol to a file from a string representation. - + add_symbol_import Adds an import to a file for a given symbol. - + Symbol } + type={ <>PySymbol } description="The symbol to import." defaultValue="" /> @@ -288,7 +268,7 @@ Adds an import to a file for a given symbol. /> ImportType } + type={ <>ImportType } description="The type of import to use. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -301,20 +281,20 @@ Adds an import to a file for a given symbol. -Import | None } description="The existing import for the symbol or None if it was added."/> +PyImport | None } description="The existing import for the symbol or None if it was added."/> ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> ### edit -Replace the source of this `Editable` with `new_src`. - +Replace the source of this file with new_src. + bool } - description="If True, adjusts the indentation of `new_src` to match the current text's indentation level. Defaults to False." + description="If True, adjusts the indentation of new_src to match the current" defaultValue="False" /> int } - description="The priority of the edit transaction. Higher priority edits are applied first. Defaults to 0." + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> 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=""/> @@ -420,7 +400,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. - + -Class | None } description="The matching Class object if found, None otherwise."/> +PyClass | None } description="The matching Class object if found, None otherwise."/> ### get_extensions Returns the file extensions associated with Python files. - + list[str] } description="A list containing '.py' as the only Python file extension."/> @@ -445,7 +425,7 @@ Returns the file extensions associated with Python files. ### get_function Returns a specific Function by name. - + -Function | None } description="The matching Function object if found, None otherwise."/> +PyFunction | None } description="The matching Function object if found, None otherwise."/> ### get_global_var Returns a specific global var by name. Returns None if not found. - + -Assignment | None } description="The global variable if found, None otherwise."/> +PyAssignment | None } description="The global variable if found, None otherwise."/> ### get_import Returns the import with matching alias. Returns None if not found. - + -Import | None } description="The import statement with the matching alias if found, None otherwise."/> +PyImport | None } description="The import statement with the matching alias if found, None otherwise."/> ### 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. - + ImportType, optional } + type={ <>ImportType , optional } description="Type of import statement to generate. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -551,12 +531,12 @@ 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."/> +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."/> ### get_symbol Gets a symbol by its name from the file. - + -Symbol | None } description="The found symbol, or None if not found."/> +PySymbol | None } description="The found symbol, or None if not found."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -703,7 +683,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=""/> @@ -711,7 +691,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=""/> @@ -719,7 +699,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -727,7 +707,7 @@ Removes the file from the file system and graph. ### 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. - +Replace occurrences of text in the file. + str } - description="The text or pattern to search for." + description="The text to be replaced." defaultValue="" /> str } - description="The text to replace matches with." + description="The text to replace with." defaultValue="" /> int, optional } - description="Maximum number of replacements to make. Defaults to -1 (replace all)." + type={ int } + description="Maximum number of replacements to make. -1 means replace all occurrences." defaultValue="-1" /> bool, optional } - description="Whether to treat 'old' as a regex pattern. Defaults to False." + type={ bool } + description="If True, treat 'old' as a regular expression pattern." defaultValue="False" /> int, optional } - description="Priority of the replacement operation. Defaults to 0." + type={ int } + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> -int } description="The total number of replacements made."/> +int } description="List of affected Editable objects. For non-source files, always returns an empty list since they don't have Editable sub-components."/> ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + symbol_can_be_added Checks if a Python symbol can be added to this Python source file. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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 | TInterface] } 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"/> +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"/> ### 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. - + ### code_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -46,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -79,29 +68,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ PyCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -115,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -134,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=""/> @@ -165,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=""/> @@ -254,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -367,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=""/> @@ -375,7 +348,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=""/> @@ -383,7 +356,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), [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) @@ -28,7 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +PyCodeBlock } description="The block of code associated with the code object." /> ### comment @@ -40,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -60,12 +60,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -141,29 +136,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_functions -list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> - -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> +list[ PyFunction ] } description="Returns a list of nested functions defined within this function's code block." /> ### parameters -SymbolGroup [ Parameter , PyFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ PyParameter , PyFunction ] | list[ PyParameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -179,8 +168,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ PyFunction ] } description="The type of value returned by the callable, or a placeholder." /> ### source @@ -188,18 +176,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Function." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , PyFunction ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -210,7 +191,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=""/> @@ -310,7 +291,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -318,7 +299,7 @@ Modifies the function to be asynchronous. ### 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[ PyFunction ] } description=""/> @@ -407,7 +388,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 symbol. - + ImportType } + type={ <>ImportType } description="Type of import to generate. If WILDCARD, generates star import. Defaults to UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -445,12 +426,12 @@ 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."/> +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."/> ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + -Parameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> +PyParameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> ### get_parameter_by_index Returns the parameter at the given index. - + -Parameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> +PyParameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> ### get_parameter_by_type Retrieves a parameter from the callable by its type. - + Symbol } + type={ <>PySymbol } description="The type to search for." defaultValue="" /> -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +PyParameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -643,12 +624,12 @@ 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. - + SourceFile } + type={ <>PyFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -672,7 +653,7 @@ 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=""/> @@ -680,7 +661,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=""/> @@ -705,7 +686,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_inline_comment Sets an inline comment to the symbol. - + set_return_type Sets or modifies the return type annotation of a function. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,27 +46,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parameters Collection[ Type , PyGenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -111,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=""/> @@ -203,12 +183,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,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=""/> @@ -329,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=""/> @@ -337,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(). - + ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +PyCodeBlock } description="The block of code associated with the code object." /> ### decorators @@ -40,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -59,23 +54,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; bool } description="Returns whether the symbol is decorated with decorators." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -134,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=""/> @@ -223,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -336,7 +320,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=""/> @@ -344,7 +328,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 +336,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 [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -29,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative_blocks -list[ IfBlockStatement ] } description="Returns a list of alternative if/elif/else blocks for the current block." /> +list[ PyIfBlockStatement ] } description="Returns a list of alternative if/elif/else blocks for the current block." /> ### condition @@ -37,11 +28,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### consequence_block -CodeBlock } description="The code block that is executed if the condition is True." /> +PyCodeBlock } description="The code block that is executed if the condition is True." /> ### else_statement -IfBlockStatement | None } description="Returns the else block within the if-statement." /> +PyIfBlockStatement | None } description="Returns the else block within the if-statement." /> ### extended @@ -53,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -86,29 +72,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested code blocks within an if/elif/else statement block." /> +list[ PyCodeBlock ] } description="Returns all nested code blocks within an if/elif/else statement block." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyIfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -122,16 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -141,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=""/> @@ -149,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."/> +list[ PyIfBlockStatement ] } description="A list of elif block statements. Empty list if no elif blocks exist."/> ### 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=""/> @@ -246,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -359,7 +329,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=""/> @@ -367,7 +337,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) @@ -20,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" -" /> +Editable | None } description="The alias of the imported symbol, if one exists." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -37,12 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -50,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### from_file -SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> +PyFile | None } description="Returns the SourceFile that an Import is importing from." /> ### full_name @@ -66,12 +60,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statement -ImportStatement } description="the ImportStatement that this import belongs to" /> +PyImportStatement } description="The statement that this import is part of." /> ### import_type -ImportType } description=" -" /> +ImportType } description="The type of import, indicating how the symbol is imported." /> ### imported_exports @@ -79,12 +72,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imported_symbol -Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +PySymbol | ExternalModule | PyFile | PyImport | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> + +### is_dynamic + +bool } description="Determines if this import is dynamically loaded based on its parent symbol." /> ### module -Editable | None } description=" -" /> +Editable | None } description="The module from which the symbol is being imported, if applicable." /> ### name @@ -94,23 +90,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Returns the namespace of the import if it imports a file, or None otherwise." /> -### node_type - -Literal[NodeType.IMPORT] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,7 +108,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolved_symbol -Symbol | ExternalModule | SourceFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> +PySymbol | ExternalModule | PyFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> ### resolved_value @@ -134,17 +124,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### to_file -SourceFile } description="SourceFile that this import resides in." /> +PyFile } description="SourceFile that this import resides in." /> ### to_file_id -NodeId } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +NodeId } description="The node ID of the file to which this import belongs." /> ### variable_usages @@ -155,7 +139,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=""/> @@ -163,7 +147,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[ PyImport ] } description=""/> @@ -252,7 +236,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. - + ImportType } + type={ <>ImportType } description="Type of import to generate. Defaults to UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -290,12 +274,12 @@ 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."/> +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."/> ### 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."/> @@ -416,7 +400,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."/> @@ -424,7 +408,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."/> @@ -432,7 +416,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."/> @@ -440,7 +424,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=""/> @@ -448,7 +432,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=""/> @@ -456,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=""/> @@ -464,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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) @@ -28,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -45,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ PyImport , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -59,23 +54,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,16 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -108,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=""/> @@ -116,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=""/> @@ -205,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,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=""/> @@ -326,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=""/> @@ -334,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 [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) @@ -20,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition @@ -45,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -70,29 +64,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ PyCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyMatchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -106,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -125,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=""/> @@ -156,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=""/> @@ -245,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -358,7 +336,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=""/> @@ -366,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=""/> @@ -374,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(). - + ### cases -list[ SwitchCase ] } description=" -" /> +list[ SwitchCase ] } description="A list of switch cases." /> ### extended @@ -33,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,29 +48,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> +list[ PyCodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ PyMatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -90,19 +78,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ PyMatchStatement ] } description="The value to switch on." /> ### variable_usages @@ -113,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=""/> @@ -121,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=""/> @@ -210,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -323,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=""/> @@ -331,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=""/> @@ -339,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(). - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -56,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -86,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -100,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=""/> @@ -108,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=""/> @@ -200,12 +179,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -318,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=""/> @@ -326,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=""/> @@ -334,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 [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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -36,12 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -75,23 +70,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -105,11 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> @@ -127,7 +111,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=""/> @@ -152,7 +136,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[ PyParameter ] } description=""/> @@ -244,12 +228,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -362,7 +346,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=""/> @@ -370,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=""/> @@ -378,7 +362,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_type_annotation Sets the type annotation of a parameter. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="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) @@ -28,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyPassStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,16 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -104,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=""/> @@ -112,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=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,7 +301,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=""/> @@ -330,7 +309,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) @@ -23,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits or creates a return type annotation for a method or function. - + content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" -" /> +Collection[ Expression [ Editable ], PyString ] } description="A collection of string fragments and escape sequences in TS, or a single string content in Python." /> ### expressions -list[ Expression [ Editable ]] } description="embedded expressions in the string, only applicable for templated or formatted strings" /> +list[ Expression [ Editable ]] } description="Embedded expressions in the string, only applicable for templated or formatted strings." /> ### extended @@ -41,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -56,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -86,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -104,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=""/> @@ -112,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=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ PySymbol , PyImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -40,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -71,23 +66,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -103,13 +92,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type -SymbolType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +SymbolType } description="The type of the symbol." /> ### variable_usages @@ -120,7 +103,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=""/> @@ -180,7 +163,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ PySymbol ] } description=""/> @@ -269,7 +252,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 symbol. - + ImportType } + type={ <>ImportType } description="Type of import to generate. If WILDCARD, generates star import. Defaults to UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -307,12 +290,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -431,12 +414,12 @@ 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. - + SourceFile } + type={ <>PyFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -460,7 +443,7 @@ 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=""/> @@ -468,7 +451,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=""/> @@ -476,7 +459,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ PyImport | PySymbol | Export ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + ### code_block -CodeBlock | None } description=" -" /> +PyCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -49,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -62,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### finalizer -BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> +PyBlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> ### function_calls @@ -84,23 +74,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -114,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -133,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=""/> @@ -164,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=""/> @@ -253,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -366,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=""/> @@ -374,7 +348,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=""/> @@ -382,7 +356,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) @@ -32,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -165,7 +145,7 @@ 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=""/> @@ -173,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,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=""/> @@ -310,7 +290,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=""/> diff --git a/docs/api-reference/python/PyWhileStatement.mdx b/docs/api-reference/python/PyWhileStatement.mdx index 98c080678..213352444 100644 --- a/docs/api-reference/python/PyWhileStatement.mdx +++ b/docs/api-reference/python/PyWhileStatement.mdx @@ -2,11 +2,7 @@ title: "PyWhileStatement" sidebarTitle: "PyWhileStatement" icon: "" -description: "An abstract representation of a python while statement. - -Attributes: -else_statement (PyIfBlockStatement | None): the statement that will run if the while loop completes, if any. -" +description: "An abstract representation of a python while statement." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -24,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +PyCodeBlock } description="The code block that represents the body of the while statement." /> ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ PyWhileStatement ] } description="The condition expression of the while statement." /> ### decorators @@ -53,12 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +PyFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -84,23 +74,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ PyWhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +PyClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +PyFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -114,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -133,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=""/> @@ -164,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=""/> @@ -253,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -366,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=""/> @@ -374,7 +348,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=""/> @@ -382,7 +356,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), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -36,12 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -63,23 +58,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -97,11 +86,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -111,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=""/> @@ -142,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=""/> @@ -234,12 +218,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -369,7 +353,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 +361,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 +369,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_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) @@ -28,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -43,23 +38,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -77,11 +66,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable [ JSXExpression ] | None } description="Returns the editable component of this JSX expression." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -91,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=""/> @@ -99,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=""/> @@ -188,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +285,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 +293,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/api-reference/typescript/JSXProp.mdx b/docs/api-reference/typescript/JSXProp.mdx index d864ec12e..af984f920 100644 --- a/docs/api-reference/typescript/JSXProp.mdx +++ b/docs/api-reference/typescript/JSXProp.mdx @@ -32,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -103,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=""/> @@ -111,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=""/> @@ -203,12 +187,12 @@ 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."/> +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."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,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=""/> @@ -329,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=""/> @@ -337,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(). - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -84,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -98,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=""/> @@ -106,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=""/> @@ -198,12 +179,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -316,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=""/> @@ -324,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=""/> @@ -332,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 [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) ## Attributes -### assignment_types - -list[str] } description="List of valid TypeScript assignment node types that this class can handle." /> - ### comment TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -60,12 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -111,23 +94,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -147,17 +124,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.GlobalVar." /> ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ TSAssignment ] } description="The type annotation associated with this node" /> ### value @@ -172,7 +143,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=""/> @@ -232,7 +203,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ TSAssignment ] } description=""/> @@ -321,7 +292,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_named_expression Creates a MultiExpression object from a TypeScript named expression node. - + get_import_string Generates the appropriate import string for a symbol. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -394,12 +365,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -526,12 +497,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -555,7 +526,7 @@ 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=""/> @@ -580,7 +551,7 @@ Simplifies an assignment expression by reducing it based on a boolean 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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) ## Attributes -### assignment_types - - } description=" -" /> - ### assignments -list[ Assignment ] } description=" -" /> +list[ TSAssignment ] } description="A list of assignments within the statement." /> ### extended @@ -43,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -64,8 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ TSAssignment ] } description="The left-hand side expression of the first assignment." /> ### nested_code_blocks @@ -75,23 +58,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TSAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -103,23 +80,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ TSAssignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -133,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=""/> @@ -141,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=""/> @@ -230,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -343,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=""/> @@ -351,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=""/> @@ -359,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(). - + ### assignment -Assignment } description=" -" /> - -### assignment_types - - } description=" -" /> +TSAssignment } description="The assignment associated with the attribute." /> ### assignments -list[ Assignment ] } description=" -" /> +list[ TSAssignment ] } description="A list of assignments within the statement." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -47,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -80,8 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" -" /> +Expression [ TSAssignment ] } description="The left-hand side expression of the first assignment." /> ### name @@ -95,23 +82,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TSAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -123,23 +104,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -Expression [ Assignment ] | None } description=" -" /> +Expression [ TSAssignment ] | None } description="The right-hand side expression of the first assignment, or None if not applicable." /> ### source str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -153,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=""/> @@ -161,7 +131,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[ TSAttribute ] } description=""/> @@ -253,12 +223,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -388,7 +358,7 @@ 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=""/> @@ -396,7 +366,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=""/> @@ -404,7 +374,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_value Sets the value of a node's assignment. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -20,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -41,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -70,29 +64,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -106,16 +94,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -125,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=""/> @@ -156,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=""/> @@ -245,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -375,7 +353,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=""/> @@ -383,7 +361,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=""/> @@ -391,7 +369,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. - + ### code_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition -Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> +Expression [ TSCatchStatement ] | None } description="The condition which triggers this clause" /> ### decorators @@ -50,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -79,29 +68,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -115,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -134,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=""/> @@ -165,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=""/> @@ -254,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -384,7 +357,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=""/> @@ -392,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=""/> @@ -400,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 [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attribute -Attribute } description="Gets the attribute being accessed in a chained attribute expression." /> +TSAttribute } description="Gets the attribute being accessed in a chained attribute expression." /> ### extended @@ -37,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -56,27 +46,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of function calls associated with this chained attribute's object." /> -### node_type - -NodeType } description=" -" /> - ### object Object } description="Returns the object that contains the attribute being looked up." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -90,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -104,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=""/> @@ -112,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[ TSChainedAttribute ] } description=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,7 +301,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=""/> @@ -330,7 +309,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) @@ -34,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +TSCodeBlock } description="The block of code associated with the code object." /> ### comment @@ -42,11 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### constructor -Function | None } description="Returns the constructor method for this class." /> - -### constructor_keyword - - } description="The keyword used to identify the constructor method." /> +TSFunction | None } description="Returns the constructor method for this class." /> ### decorators @@ -54,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -62,7 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -82,12 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -141,36 +122,29 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ TSClass ] } description="Retrieves the nested classes defined within this class." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parameters -SymbolGroup [ Parameter , TSClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ TSParameter , TSClass ] | list[ TSParameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_class_names -list[ Name | ChainedAttribute ] } description="Returns a list of the parent class names that this class inherits from." /> +list[ Name | TSChainedAttribute ] } description="Returns a list of the parent class names that this class inherits from." /> ### parent_classes -Parents[ Type , PyClass ] | None } description=" -" /> +Parents[ Type , TSClass ] | None } description="The parent classes of this class, if any." /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -182,8 +156,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ TSClass ] } description="The type of value returned by the callable, or a placeholder." /> ### semicolon_node @@ -195,18 +168,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Class." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , TSClass ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -217,12 +183,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + Attribute } + type={ <>TSAttribute } description="The attribute to add to the class." defaultValue="" /> @@ -240,7 +206,7 @@ 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=""/> @@ -357,7 +323,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 - + -list[ Attribute ] } description="A list of unique attributes from this class and its superclasses. If an attribute is defined in multiple classes, the first definition encountered is used."/> +list[ TSAttribute ] } description="A list of unique attributes from this class and its superclasses. If an attribute is defined in multiple classes, the first definition encountered is used."/> ### class_component_to_function_component Converts a class component to a function component. - + None } description=""/> @@ -388,7 +354,7 @@ Converts a class component to a function component. ### convert_props_to_interface Converts React component props to TypeScript interfaces. - + None } description=""/> @@ -396,7 +362,7 @@ Converts React component props to TypeScript interfaces. ### 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[ TSClass ] } description=""/> @@ -485,7 +451,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + -Attribute | None } description="The matching attribute if found, None otherwise. If multiple attributes with the same name exist in the inheritance hierarchy, returns the first one found."/> +TSAttribute | None } description="The matching attribute if found, None otherwise. If multiple attributes with the same name exist in the inheritance hierarchy, returns the first one found."/> ### 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. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -554,7 +520,7 @@ Generates the appropriate import string for a symbol. ### get_method Returns a specific method by name from the class or any of its superclasses. - + -Function | None } description="The method if found, None otherwise."/> +TSFunction | None } description="The method if found, None otherwise."/> ### get_name @@ -574,12 +540,12 @@ 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."/> +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."/> ### 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. - + -Parameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> +TSParameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> ### get_parameter_by_index Returns the parameter at the given index. - + -Parameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> +TSParameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> ### get_parameter_by_type Retrieves a parameter from the callable by its type. - + Symbol } + type={ <>TSSymbol } description="The type to search for." defaultValue="" /> -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +TSParameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> ### 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_subclass_of Checks if the class inherits from a specified parent class. - + str | Class } + type={ <>str | TSClass } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" /> @@ -798,7 +764,7 @@ 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=""/> @@ -806,7 +772,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 - + -list[ Function ] | MultiLineCollection [ Function , TSClass ] } description=""/> +list[ TSFunction ] | MultiLineCollection [ TSFunction , TSClass ] } description=""/> ### move_to_file Moves the given symbol to a new file and updates its imports and references. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -864,7 +830,7 @@ 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=""/> @@ -872,7 +838,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=""/> @@ -880,7 +846,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. - + subclasses Returns all classes which subclass this class. - + -list[ Class ] } description="A list of Class objects that inherit from this class."/> +list[ TSClass ] } description="A list of Class objects that inherit from this class."/> ### superclasses Returns a list of all classes that this class extends, up to max_depth. - + -list[ Class | ExternalModule | Interface] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> +list[ TSClass | ExternalModule | TSInterface ] } description="A list of all superclass symbols in MRO order, up to max_depth. Returns an empty list if the class has no parent classes."/> ### symbol_usages @@ -1176,12 +1142,12 @@ Returns a list of symbols that use or import the exportable object. -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -20,19 +20,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignment_statements -list[ AssignmentStatement [ TSCodeBlock , Assignment ]] } description="Returns list of top level assignment statements in the code block." /> +list[ TSAssignmentStatement [ TSCodeBlock , TSAssignment ]] } description="Returns list of top level assignment statements in the code block." /> ### assignments -list[ Assignment [ Editable , TSCodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> +list[ TSAssignment [ Editable , TSCodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> ### attributes -list[ Attribute [ Editable , TSCodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> +list[ TSAttribute [ Editable , TSCodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> ### comments -list[ Comment [ Editable , TSCodeBlock ]] } description="Gets list of top level comments in the code block." /> +list[ TSComment [ Editable , TSCodeBlock ]] } description="Gets list of top level comments in the code block." /> ### extended @@ -44,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -61,39 +56,31 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### if_blocks -list[ IfBlockStatement [ TSCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> +list[ TSIfBlockStatement [ TSCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> ### level -int } description=" -" /> +int } description="The indentation level of the code block." /> ### local_var_assignments -list[ Assignment [ Editable , TSCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> - -### node_type - -NodeType } description=" -" /> +list[ TSAssignment [ Editable , TSCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The parent code block containing this block, or None if it is a top-level block." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -119,11 +106,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -133,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=""/> @@ -141,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=""/> @@ -230,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. - + -list[ Assignment [ Editable , TSCodeBlock ]] } description="A list of Assignment objects that match the variable name."/> +list[ TSAssignment [ Editable , TSCodeBlock ]] } description="A list of Assignment objects that match the variable name."/> ### get_attributes Returns attributes from the code block, with the option to include or exclude private - + -list[ Attribute [ Editable , TSCodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> +list[ TSAttribute [ Editable , TSCodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> ### get_comment Gets the first comment statement containing a specific text string. - + -Comment [ Editable , TSCodeBlock ] | None } description="The first comment statement containing the search text, or None if no matching comment is found."/> +TSComment [ Editable , TSCodeBlock ] | None } description="The first comment statement containing the search text, or None if no matching comment is found."/> ### get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + -Assignment [ Editable , TSCodeBlock ] | None } description="The first matching local variable assignment, or None if no match is found."/> +TSAssignment [ Editable , TSCodeBlock ] | None } description="The first matching local variable assignment, or None if no match is found."/> ### get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + -list[ Assignment [ Editable , TSCodeBlock ]] } description="List of Assignment objects representing local variable assignments that match the specified name criteria."/> +list[ TSAssignment [ Editable , TSCodeBlock ]] } description="List of Assignment objects representing local variable assignments that match the specified name criteria."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -438,7 +420,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=""/> @@ -446,7 +428,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=""/> @@ -454,7 +436,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=""/> @@ -590,7 +572,7 @@ Unwraps a code block by removing its opening and closing braces. ### wrap Wraps a code block with a statement and indents it. - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -53,29 +48,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> +list[ TSCodeBlock ] } description="Returns a list of nested code blocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSComment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,20 +78,10 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - ### text str } description="Returns the text content of the comment." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -112,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=""/> @@ -137,7 +116,7 @@ Cleans comment markers and whitespace from a comment string. ### 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[ TSComment ] } description=""/> @@ -278,7 +257,7 @@ 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -391,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=""/> @@ -399,7 +378,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=""/> @@ -407,7 +386,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(). - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -60,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -94,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Return the text content of all comments in the comment block." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -108,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=""/> @@ -151,7 +126,7 @@ Replace the source of this node with new text. ### edit_text Replace the text content of a comment group with new text. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSCommentGroup ] } description=""/> @@ -222,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,7 +310,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=""/> @@ -343,7 +318,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=""/> diff --git a/docs/api-reference/typescript/TSCommentType.mdx b/docs/api-reference/typescript/TSCommentType.mdx index b6f114aad..3795f4508 100644 --- a/docs/api-reference/typescript/TSCommentType.mdx +++ b/docs/api-reference/typescript/TSCommentType.mdx @@ -2,17 +2,7 @@ title: "TSCommentType" sidebarTitle: "TSCommentType" icon: "" -description: "An enumeration representing different types of comments in TypeScript. - -Represents the possible types of comments that can be used in TypeScript code, -including double slash comments (//), slash star comments (/* */), and unknown -comment types. - -Attributes: -DOUBLE_SLASH (str): Represents a single-line comment starting with //. -SLASH_STAR (str): Represents a multi-line comment enclosed in /* */. -UNKNOWN (str): Represents an unknown or unrecognized comment type. -" +description: "An enumeration representing different types of comments in TypeScript. Represents the possible types of comments that can be used in TypeScript code, including double slash comments (//), slash star comments (/* */), and unknown comment types." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; diff --git a/docs/api-reference/typescript/TSConditionalType.mdx b/docs/api-reference/typescript/TSConditionalType.mdx index a5d7c7a05..b14335392 100644 --- a/docs/api-reference/typescript/TSConditionalType.mdx +++ b/docs/api-reference/typescript/TSConditionalType.mdx @@ -2,11 +2,7 @@ title: "TSConditionalType" sidebarTitle: "TSConditionalType" icon: "" -description: "Conditional Type - -Examples: -typeof s -" +description: "Conditional Type Examples: typeof s" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -15,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) @@ -24,13 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -TSType[ TSConditionalType ] } description=" -" /> +TSType[ TSConditionalType ] } description="The type if the condition is false." /> ### consequence -TSType[ TSConditionalType ] } description=" -" /> +TSType[ TSConditionalType ] } description="The type if the condition is true." /> ### extended @@ -42,12 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -59,26 +48,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -TSType[ TSConditionalType ] } description=" -" /> - -### node_type - -NodeType } description=" -" /> +TSType[ TSConditionalType ] } description="The left-hand side type of the conditional type." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -90,18 +72,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### right -TSType[ TSConditionalType ] } description=" -" /> +TSType[ TSConditionalType ] } description="The right-hand side type of the conditional type." /> ### source str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -111,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=""/> @@ -119,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=""/> @@ -208,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,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=""/> @@ -329,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=""/> @@ -337,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(). - + + ## Attributes @@ -26,18 +26,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### config -dict } description=" -" /> +dict } description="A dictionary containing the parsed configuration settings." /> ### config_file -File } description=" -" /> +File } description="The configuration file object representing the tsconfig.json file." /> ### config_parser -TSConfigParser } description=" -" /> +TSConfigParser } description="The parser used to interpret the TypeScript configuration." /> ### out_dir @@ -72,7 +69,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolve_base_url Resolves an import path with the base url. - + str } description=""/> @@ -80,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) @@ -32,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -99,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=""/> @@ -107,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=""/> @@ -199,12 +183,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,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=""/> @@ -325,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=""/> @@ -333,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 [Dict](/api-reference/core/Dict), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -28,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -43,23 +38,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -73,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### unpack -Unpack [ TSObjectType ] | None } description=" -" /> +Unpack [ TSDict ] | None } description="An optional unpacking element, if present." /> ### variable_usages @@ -92,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=""/> @@ -100,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=""/> @@ -189,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,7 +285,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=""/> @@ -310,7 +293,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=""/> @@ -318,7 +301,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) @@ -24,13 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### body -Expression [ TSEnum ] } description=" -" /> +Expression [ TSEnum ] } description="The expression representing the body of the enum." /> ### code_block -TSCodeBlock } description=" -" /> +TSCodeBlock } description="The code block associated with the enum." /> ### comment @@ -42,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -50,7 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -70,12 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -117,23 +110,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -153,13 +140,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Enum." /> ### variable_usages @@ -170,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=""/> @@ -253,7 +234,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ TSEnum ] } description=""/> @@ -342,7 +323,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### 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. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -414,12 +395,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -538,12 +519,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -567,7 +548,7 @@ 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=""/> @@ -575,7 +556,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=""/> @@ -583,7 +564,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### descendant_symbols @@ -32,12 +32,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### export_statement -ExportStatement } description=" -" /> +ExportStatement } description="The statement representing the export." /> ### exported_name @@ -57,12 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -92,23 +86,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.EXPORT] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -126,11 +114,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Returns the source code of the symbol." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -144,7 +127,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=""/> @@ -152,7 +135,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[ TSExport ] } description=""/> @@ -241,7 +224,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. - + ImportType } + type={ <>ImportType } description="The type of import to generate." defaultValue="ImportType.UNKNOWN" /> @@ -279,12 +262,12 @@ 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."/> +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."/> ### 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."/> @@ -397,7 +380,7 @@ Determines if the Export object is aliased. ### 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."/> @@ -405,7 +388,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."/> @@ -430,7 +413,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."/> @@ -438,7 +421,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."/> @@ -463,7 +446,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."/> @@ -471,7 +454,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=""/> @@ -479,7 +462,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=""/> @@ -487,7 +470,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=""/> @@ -495,7 +478,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=""/> @@ -503,7 +486,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."/> @@ -511,7 +494,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(). - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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'`"/> @@ -692,7 +675,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) @@ -36,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -59,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -111,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=""/> @@ -203,12 +183,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,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=""/> @@ -329,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=""/> @@ -337,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 [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) @@ -20,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ Class ] } description="Returns all Classes in the file." /> +list[ TSClass ] } description="Returns all Classes in the file." /> ### code_block -CodeBlock } description=" -" /> +TSCodeBlock } description="Represents the block of code contained in the file." /> ### content @@ -41,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### directory @@ -53,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### export_statements @@ -83,15 +82,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; TSFile } description="A property that returns the file object for non-source files." /> -### file_node_id - -NodeId } description=" -" /> - ### file_path -str } description=" -" /> +str } description="The relative file path as a string." /> ### filepath @@ -107,11 +100,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### functions -list[ Function ] } description="Returns all Functions in the file." /> +list[ TSFunction ] } description="Returns all Functions in the file." /> ### global_vars -list[ Assignment ] } description="Returns all GlobalVars in the file." /> +list[ TSAssignment ] } description="Returns all GlobalVars in the file." /> ### import_module_name @@ -119,19 +112,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statements -list[ ImportStatement ] } description="Returns all ImportStatements in the file, where each import statement can contain" /> +list[ TSImportStatement ] } description="Returns all ImportStatements in the file, where each import statement can contain" /> ### importers -list[ Import ] } description="Returns all imports that directly imports this file as a module." /> +list[ TSImport ] } description="Returns all imports that directly imports this file as a module." /> ### imports -list[ Import ] } description="List of all Imports in this file." /> +list[ TSImport ] } description="List of all Imports in this file." /> ### inbound_imports -list[ Import ] } description="Returns all imports that are importing symbols contained in this file." /> +list[ TSImport ] } description="Returns all imports that are importing symbols contained in this file." /> ### interfaces @@ -165,27 +158,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ TSExport ] } description="Returns the named exports declared in the file." /> -### node_type - -Literal[NodeType.FILE] } description=" -" /> - ### owners set[str] } description="Returns the CODEOWNERS of the file." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -193,13 +180,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### path -Path } description=" -" /> +Path } description="The absolute path of the file as a Path object." /> ### programming_language - } description=" -" /> + } description="The programming language of the file. Set to ProgrammingLanguage.TYPESCRIPT." /> ### resolved_value @@ -215,17 +200,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols_sorted_topologically -list[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> +list[ TSSymbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> ### ts_config -TSConfig | None } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +TSConfig | None } description="The ts_config file nearest to this file." /> ### types @@ -240,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_from_import_string Adds import to the file from a string representation of an import statement. - + add_symbol Adds `symbol` to the file. - + Symbol } + type={ <>TSSymbol } description="The symbol to add to the file." defaultValue="" /> @@ -315,12 +294,12 @@ Adds `symbol` to the file. -Symbol | None } description="The existing symbol if it already exists in the file or None if it was added."/> +TSSymbol | None } description="The existing symbol if it already exists in the file or None if it was added."/> ### add_symbol_from_source Adds a symbol to a file from a string representation. - + add_symbol_import Adds an import to a file for a given symbol. - + Symbol } + type={ <>TSSymbol } description="The symbol to import." defaultValue="" /> @@ -354,7 +333,7 @@ Adds an import to a file for a given symbol. /> ImportType } + type={ <>ImportType } description="The type of import to use. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -367,20 +346,20 @@ Adds an import to a file for a given symbol. -Import | None } description="The existing import for the symbol or None if it was added."/> +TSImport | None } description="The existing import for the symbol or None if it was added."/> ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> ### edit -Replace the source of this `Editable` with `new_src`. - +Replace the source of this file with new_src. + bool } - description="If True, adjusts the indentation of `new_src` to match the current text's indentation level. Defaults to False." + description="If True, adjusts the indentation of new_src to match the current" defaultValue="False" /> int } - description="The priority of the edit transaction. Higher priority edits are applied first. Defaults to 0." + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> 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=""/> @@ -486,7 +465,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. - + -Class | None } description="The matching Class object if found, None otherwise."/> +TSClass | None } description="The matching Class object if found, None otherwise."/> ### 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."/> @@ -528,7 +507,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'."/> @@ -576,7 +555,7 @@ Returns a list of file extensions that this class can parse. ### get_function Returns a specific Function by name. - + -Function | None } description="The matching Function object if found, None otherwise."/> +TSFunction | None } description="The matching Function object if found, None otherwise."/> ### get_global_var Returns a specific global var by name. Returns None if not found. - + -Assignment | None } description="The global variable if found, None otherwise."/> +TSAssignment | None } description="The global variable if found, None otherwise."/> ### get_import Returns the import with matching alias. Returns None if not found. - + -Import | None } description="The import statement with the matching alias if found, None otherwise."/> +TSImport | None } description="The import statement with the matching alias if found, None otherwise."/> ### get_import_string Generates and returns an import statement for the file. - + ImportType } + type={ <>ImportType } description="The type of import statement. Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -662,7 +641,7 @@ Generates and returns an import statement for the file. ### get_interface Retrieves a specific interface from the file by its name. - + -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."/> +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."/> ### get_namespace Returns a specific namespace by name from the file's namespaces. - + get_symbol Gets a symbol by its name from the file. - + -Symbol | None } description="The found symbol, or None if not found."/> +TSSymbol | None } description="The found symbol, or None if not found."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -891,7 +870,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=""/> @@ -899,7 +878,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=""/> @@ -907,7 +886,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -915,7 +894,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -923,7 +902,7 @@ Removes unused exports from the file. ### 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. - +Replace occurrences of text in the file. + str } - description="The text or pattern to search for." + description="The text to be replaced." defaultValue="" /> str } - description="The text to replace matches with." + description="The text to replace with." defaultValue="" /> int, optional } - description="Maximum number of replacements to make. Defaults to -1 (replace all)." + type={ int } + description="Maximum number of replacements to make. -1 means replace all occurrences." defaultValue="-1" /> bool, optional } - description="Whether to treat 'old' as a regex pattern. Defaults to False." + type={ bool } + description="If True, treat 'old' as a regular expression pattern." defaultValue="False" /> int, optional } - description="Priority of the replacement operation. Defaults to 0." + type={ int } + description="The priority of the edit transaction. Higher priority edits are" defaultValue="0" /> -int } description="The total number of replacements made."/> +int } description="List of affected Editable objects. For non-source files, always returns an empty list since they don't have Editable sub-components."/> ### 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. - + symbol_can_be_added Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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 | TInterface] } 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"/> +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"/> ### 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) @@ -29,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition @@ -54,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -103,29 +88,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -139,16 +118,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -158,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=""/> @@ -189,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=""/> @@ -278,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -408,7 +377,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=""/> @@ -416,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=""/> @@ -424,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), [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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +TSCodeBlock } description="The block of code associated with the code object." /> ### comment @@ -36,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -64,12 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -165,29 +160,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_functions -list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> - -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> +list[ TSFunction ] } description="Returns a list of nested functions defined within this function's code block." /> ### parameters -SymbolGroup [ Parameter , TSFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ TSParameter , TSFunction ] | list[ TSParameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -203,8 +192,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### return_type -Type | Placeholder [ ExternalModule ] } description=" -" /> +Type | Placeholder [ TSFunction ] } description="The type of value returned by the callable, or a placeholder." /> ### semicolon_node @@ -216,18 +204,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Function." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , TSFunction ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -238,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=""/> @@ -338,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=""/> @@ -363,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=""/> @@ -371,7 +352,7 @@ Converts React component props to TypeScript interfaces. ### 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[ TSFunction ] } description=""/> @@ -460,7 +441,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_import_string Generates the appropriate import string for a symbol. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -515,12 +496,12 @@ 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."/> +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."/> ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + -Parameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> +TSParameter | None } description="The parameter with the specified name, or None if no parameter with that name exists or if there are no parameters."/> ### get_parameter_by_index Returns the parameter at the given index. - + -Parameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> +TSParameter | None } description="The parameter at the specified index, or None if the parameter list is empty or the index does not exist."/> ### get_parameter_by_type Retrieves a parameter from the callable by its type. - + Symbol } + type={ <>TSSymbol } description="The type to search for." defaultValue="" /> -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +TSParameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> ### 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_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=""/> @@ -730,12 +711,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -759,7 +740,7 @@ 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=""/> @@ -767,7 +748,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=""/> @@ -792,7 +773,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_return_type Sets the return type annotation for the function. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + number -" +description: "Function type definition. Example: a: (a: number) => number" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -18,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) @@ -35,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -52,13 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### name -None } description=" -" /> - -### node_type - -NodeType } description=" -" /> +None } description="This lets parameters generate their node_id properly." /> ### parameters @@ -66,16 +48,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -93,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -107,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=""/> @@ -115,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=""/> @@ -123,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=""/> @@ -212,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -325,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=""/> @@ -333,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=""/> @@ -341,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(). - + ` -" +description: "Generic type Examples: `Array`" --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -15,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -32,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,27 +46,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parameters Collection[ Type , TSGenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -111,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=""/> @@ -203,12 +183,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,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=""/> @@ -329,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=""/> @@ -337,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 [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -26,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that may trigger an exception" /> +TSCodeBlock } description="The block of code associated with the code object." /> ### decorators @@ -46,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -69,23 +58,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ JSXElement [ TSHasBlock ]] } description="Returns a list of all JSX elements contained within this symbol." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -99,11 +82,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -113,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=""/> @@ -144,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=""/> @@ -233,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -363,7 +341,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=""/> @@ -371,7 +349,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=""/> @@ -379,7 +357,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. - + ### alternative_blocks -list[ IfBlockStatement ] } description="Returns a list of alternative if/elif/else blocks for the current block." /> +list[ TSIfBlockStatement ] } description="Returns a list of alternative if/elif/else blocks for the current block." /> ### condition -Expression [ PyIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> +Expression [ TSIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> ### consequence_block -CodeBlock } description="The code block that is executed if the condition is True." /> +TSCodeBlock } description="The code block that is executed if the condition is True." /> ### else_statement -IfBlockStatement | None } description="Returns the else block within the if-statement." /> +TSIfBlockStatement | None } description="Returns the else block within the if-statement." /> ### extended @@ -54,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -87,29 +72,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested code blocks within an if/elif/else statement block." /> +list[ TSCodeBlock ] } description="Returns all nested code blocks within an if/elif/else statement block." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSIfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -123,16 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -142,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=""/> @@ -150,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."/> +list[ TSIfBlockStatement ] } description="A list of elif block statements. Empty list if no elif blocks exist."/> ### 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=""/> @@ -247,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -360,7 +329,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=""/> @@ -368,7 +337,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) @@ -20,16 +20,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" -" /> +Editable | None } description="The alias of the imported symbol, if one exists." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -45,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -58,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### from_file -SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> +TSFile | None } description="Returns the SourceFile that an Import is importing from." /> ### full_name @@ -74,12 +68,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statement -ImportStatement } description="the ImportStatement that this import belongs to" /> +TSImportStatement } description="The statement that this import is part of." /> ### import_type -ImportType } description=" -" /> +ImportType } description="The type of import, indicating how the symbol is imported." /> ### imported_exports @@ -87,7 +80,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imported_symbol -Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +TSSymbol | ExternalModule | TSFile | TSImport | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> + +### is_dynamic + +bool } description="Determines if this import is dynamically loaded based on its parent symbol." /> ### is_exported @@ -99,8 +96,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### module -Editable | None } description=" -" /> +Editable | None } description="The module from which the symbol is being imported, if applicable." /> ### name @@ -110,23 +106,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="If import is a module import, returns any namespace prefix that must be used with import reference." /> -### node_type - -Literal[NodeType.IMPORT] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -134,7 +124,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolved_symbol -Symbol | ExternalModule | TSFile | None } description="Returns the resolved symbol that the import is referencing." /> +TSSymbol | ExternalModule | TSFile | None } description="Returns the resolved symbol that the import is referencing." /> ### resolved_value @@ -150,17 +140,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### to_file -SourceFile } description="SourceFile that this import resides in." /> +TSFile } description="SourceFile that this import resides in." /> ### to_file_id -NodeId } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +NodeId } description="The node ID of the file to which this import belongs." /> ### variable_usages @@ -171,7 +155,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=""/> @@ -179,7 +163,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[ TSImport ] } description=""/> @@ -268,7 +252,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. - + ImportType } + type={ <>ImportType } description="Type of import (e.g. WILDCARD, NAMED_EXPORT). Defaults to ImportType.UNKNOWN." defaultValue="ImportType.UNKNOWN" /> @@ -306,12 +290,12 @@ 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."/> +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."/> ### 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."/> @@ -424,7 +408,7 @@ Returns True if this import is aliased. ### 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."/> @@ -466,7 +450,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."/> @@ -474,7 +458,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."/> @@ -482,7 +466,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."/> @@ -490,7 +474,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=""/> @@ -498,7 +482,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=""/> @@ -506,7 +490,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 +498,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -37,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,7 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ TSImport , TSImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -68,23 +54,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TSImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -98,16 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -117,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=""/> @@ -125,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=""/> @@ -214,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -327,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=""/> @@ -335,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=""/> @@ -343,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 -[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) +[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) ## Attributes @@ -29,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description="The code block that contains the interface's body." /> +TSCodeBlock } description="The block of code associated with the code object." /> ### comment @@ -41,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -49,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -69,12 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -116,23 +106,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_interfaces @@ -156,18 +140,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of the symbol." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , TSInterface ] | None } description="The type parameters of the symbol, if any." /> ### variable_usages @@ -178,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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -261,7 +238,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new_src. - + extends Returns True if the interface implements the given parent interface. - + bool } description=""/> @@ -304,7 +281,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[ TSInterface ] } description=""/> @@ -358,15 +335,15 @@ 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=""/> +TSAttribute | None } description=""/> ### 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. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -421,12 +398,12 @@ 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."/> +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."/> ### 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[Interface | Class ] } description=""/> +list[ TSInterface | TSClass ] } description=""/> ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -553,12 +530,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -582,7 +559,7 @@ 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=""/> @@ -590,7 +567,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=""/> @@ -598,7 +575,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -36,8 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### body -Expression | None } description=" -" /> +Expression | None } description="The body of the labeled statement, which can be an Expression or None." /> ### extended @@ -49,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -88,23 +66,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TSLabeledStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,16 +90,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -145,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=""/> @@ -237,12 +199,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -355,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=""/> @@ -363,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=""/> @@ -371,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 [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -31,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -48,30 +40,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### lookup -Expression } description=" -" /> +Expression } description="The expression used for the lookup operation." /> ### name str | None } description="Retrieves the name of the type object." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -85,15 +70,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type -TSType[ TSLookupType ] } description=" -" /> +TSType[ TSLookupType ] } description="The type of the TypeScript object being looked up." /> ### variable_usages @@ -104,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=""/> @@ -112,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=""/> @@ -201,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -314,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=""/> @@ -322,7 +301,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=""/> @@ -330,7 +309,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(). - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -84,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -98,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=""/> @@ -106,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=""/> @@ -198,12 +179,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -316,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=""/> @@ -324,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=""/> @@ -332,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), [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) @@ -24,8 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -TSCodeBlock } description=" -" /> +TSCodeBlock } description="The code block associated with this namespace." /> ### comment @@ -37,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -45,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -65,12 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -116,23 +110,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -152,17 +140,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> + } description="The type of the symbol, set to SymbolType.Namespace." /> ### symbols -list[ Symbol ] } description="Returns all symbols defined within this namespace, including nested ones." /> - -### ts_node - -TSNode } description=" -" /> +list[ TSSymbol ] } description="Returns all symbols defined within this namespace, including nested ones." /> ### variable_usages @@ -173,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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -256,7 +238,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ TSNamespace ] } description=""/> @@ -345,7 +327,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Get a class by name from this namespace. - + TSClass | None } description=""/> @@ -353,7 +335,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=""/> @@ -378,7 +360,7 @@ Get an enum by name from this namespace. ### get_function Get a function by name from this namespace. - + TSFunction | None } description="The found function, or None if not found"/> @@ -386,7 +368,7 @@ Get a function by name from this namespace. ### get_import_string Generates the appropriate import string for a symbol. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -421,7 +403,7 @@ Generates the appropriate import string for a symbol. ### get_interface Get an interface by name from this namespace. - + TSInterface | None } description=""/> @@ -432,12 +414,12 @@ 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."/> +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."/> ### get_namespace Get a namespace by name from this namespace. - + TSNamespace | None } description="The found namespace, or None if not found"/> @@ -445,7 +427,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"/> @@ -453,15 +435,15 @@ Get all nested namespaces within this namespace. ### get_symbol Get a symbol by name from this namespace. - + -Symbol | None } description="The found symbol, or None if not found"/> +TSSymbol | None } description="The found symbol, or None if not found"/> ### get_type Get a type alias by name from this namespace. - + TSTypeAlias | None } description=""/> @@ -469,7 +451,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -588,12 +570,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -617,7 +599,7 @@ 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=""/> @@ -625,7 +607,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=""/> @@ -633,7 +615,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_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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -49,23 +38,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -79,15 +62,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### unpack -Unpack [ TSObjectType ] | None } description=" -" /> +Unpack [ TSObjectType ] | None } description="An optional unpacking element, if present." /> ### variable_usages @@ -98,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=""/> @@ -106,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=""/> @@ -195,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -308,7 +285,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=""/> @@ -316,7 +293,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=""/> @@ -324,7 +301,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(). - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,30 +40,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### key -Expression } description=" -" /> +Expression } description="The key expression of the pair, expected to be of type TExpression." /> ### name str } description="Returns the source text of the key expression in the pair." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -91,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### value Expression | None } description="Gets the value node of the object." /> @@ -109,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=""/> @@ -117,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=""/> @@ -206,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -319,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=""/> @@ -335,7 +309,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(). - + dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -44,12 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -87,23 +74,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -117,14 +98,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ TSParameter ] } description="The type annotation associated with this node" /> ### value @@ -139,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=""/> @@ -155,7 +131,7 @@ Converts a parameter's inline type definition to an interface. ### 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=""/> @@ -247,12 +223,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -365,7 +341,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 +349,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=""/> @@ -381,7 +357,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_type_annotation Sets the type annotation for this parameter. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -32,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -51,23 +42,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Returns the name of the query type." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -75,8 +60,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### query -TSType[ TSQueryType ] } description=" -" /> +TSType[ TSQueryType ] } description="The TypeScript type associated with the query." /> ### resolved_value @@ -86,11 +70,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -100,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=""/> @@ -108,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=""/> @@ -197,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -310,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=""/> @@ -318,7 +297,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=""/> @@ -326,7 +305,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) @@ -32,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -51,23 +42,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the name of the type." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -81,15 +66,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### type -TSType[ TSReadonlyType ] } description=" -" /> +TSType[ TSReadonlyType ] } description="The underlying TypeScript type associated with this readonly type." /> ### variable_usages @@ -100,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=""/> @@ -108,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=""/> @@ -197,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -310,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=""/> @@ -318,7 +297,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=""/> @@ -326,7 +305,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) @@ -26,7 +21,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Modifies the return type annotation of a function. - + content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" -" /> +Collection[ Expression [ Editable ], TSString ] } description="A collection of string fragments and escape sequences in TS, or a single string content in Python." /> ### expressions -list[ Expression [ Editable ]] } description="embedded expressions in the string, only applicable for templated or formatted strings" /> +list[ Expression [ Editable ]] } description="Embedded expressions in the string, only applicable for templated or formatted strings." /> ### extended @@ -50,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -65,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -95,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -113,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=""/> @@ -121,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=""/> @@ -210,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -323,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=""/> @@ -331,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=""/> @@ -339,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 [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) @@ -24,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### condition -Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> +Expression [ TSSwitchCase ] | None } description="The condition which triggers this case" /> ### decorators @@ -53,12 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -82,29 +72,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSSwitchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,16 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - -StatementType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -168,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=""/> @@ -257,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -387,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=""/> @@ -395,7 +369,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 +377,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. - + ### cases -list[ SwitchCase ] } description=" -" /> +list[ TSSwitchCase ] } description="A list of switch cases." /> ### extended @@ -33,12 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -54,29 +48,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSSwitchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -90,19 +78,9 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ TSSwitchStatement ] } description="The value to switch on." /> ### variable_usages @@ -113,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=""/> @@ -121,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=""/> @@ -210,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -323,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=""/> @@ -331,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=""/> @@ -339,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 [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) @@ -33,11 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -57,12 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -96,23 +82,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -132,13 +112,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type -SymbolType } description=" -" /> - -### ts_node - -TSNode } description=" -" /> +SymbolType } description="The type of the symbol." /> ### variable_usages @@ -149,7 +123,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=""/> @@ -209,7 +183,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ TSSymbol ] } description=""/> @@ -298,7 +272,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Generates the appropriate import string for a symbol. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -336,12 +310,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -460,12 +434,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -489,7 +463,7 @@ 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=""/> @@ -497,7 +471,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=""/> @@ -505,7 +479,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="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) @@ -20,18 +20,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TSTernaryExpression ] | None } description="The expression to execute if the condition is false." /> ### condition -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TSTernaryExpression ] | None } description="The condition expression that determines which branch to execute." /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" -" /> +Expression [ TSTernaryExpression ] | None } description="The expression to execute if the condition is true." /> ### extended @@ -43,12 +40,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -58,23 +50,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -88,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -102,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=""/> @@ -110,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=""/> @@ -199,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -312,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=""/> @@ -320,7 +301,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(). - + code_block -CodeBlock | None } description=" -" /> +TSCodeBlock | None } description="The code block contained within the statement, if it exists." /> ### decorators @@ -49,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -62,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### finalizer -BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> +TSBlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> ### function_calls @@ -88,23 +78,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ MultiLineCollection [ Statement [ TSTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,16 +102,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -168,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=""/> @@ -257,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -387,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=""/> @@ -395,7 +369,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 +377,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) @@ -24,8 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +TSCodeBlock } description="The code block associated with this type alias." /> ### comment @@ -37,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ TSSymbol , TSImport ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring @@ -45,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### export -Export | None } description="Returns the export object that exports this symbol." /> +TSExport | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -65,12 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -112,23 +106,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; str | None } description="Retrieves the base name of the object without namespace prefixes." /> -### node_type - -Literal[NodeType.SYMBOL] } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -148,18 +136,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_type - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> + } description="The type of symbol, set to SymbolType.Type." /> ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" -" /> +TypeParameters[ Type , TSTypeAlias ] | None } description="The type parameters of the symbol, if any." /> ### value @@ -174,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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -257,7 +238,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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[ TSTypeAlias ] } description=""/> @@ -346,7 +327,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### 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. - + ImportType, optional } + type={ <>ImportType , optional } description="The type of import to generate (e.g., WILDCARD). Defaults to" defaultValue="ImportType.UNKNOWN" /> @@ -418,12 +399,12 @@ 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."/> +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."/> ### 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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -542,12 +523,12 @@ 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. - + SourceFile } + type={ <>TSFile } description="The destination file to move the symbol to." defaultValue="" /> @@ -571,7 +552,7 @@ 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=""/> @@ -579,7 +560,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=""/> @@ -587,7 +568,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. - + -list[ Import | Symbol | Export ] } description="A list of symbols that use or import the exportable object."/> +list[ TSImport | TSSymbol | TSExport ] } description="A list of symbols that use or import the exportable object."/> ### usages Returns a list of usages of the exportable object. - + file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -46,23 +38,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -76,11 +62,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -90,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=""/> @@ -98,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=""/> @@ -187,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,7 +281,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=""/> @@ -308,7 +289,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=""/> @@ -316,7 +297,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) @@ -32,12 +28,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -55,23 +46,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -89,11 +74,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; list[ Editable ] } description="Returns the list of symbols in the group." /> -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -103,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=""/> @@ -165,7 +145,7 @@ 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=""/> @@ -173,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 - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,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=""/> @@ -310,7 +290,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=""/> diff --git a/docs/api-reference/typescript/TSWhileStatement.mdx b/docs/api-reference/typescript/TSWhileStatement.mdx index a775a19ad..f5f984177 100644 --- a/docs/api-reference/typescript/TSWhileStatement.mdx +++ b/docs/api-reference/typescript/TSWhileStatement.mdx @@ -2,15 +2,7 @@ title: "TSWhileStatement" sidebarTitle: "TSWhileStatement" icon: "" -description: "A TypeScript while statement class that represents while loops and manages their condition and code block. - -This class provides functionality for handling while statements in TypeScript code, -including managing the loop's condition and associated code block. It extends the base -WhileStatement class with TypeScript-specific behavior. - -Attributes: -condition (str | None): The condition expression of the while loop. -" +description: "A TypeScript while statement class that represents while loops and manages their condition and code block. This class provides functionality for handling while statements in TypeScript code, including managing the loop's condition and associated code block. It extends the base WhileStatement class with TypeScript-specific behavior." --- import {Parameter} from '/snippets/Parameter.mdx'; import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; @@ -28,12 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock } description=" -" /> +TSCodeBlock } description="The code block that represents the body of the while statement." /> ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ TSWhileStatement ] } description="The condition expression of the while statement." /> ### decorators @@ -53,12 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### file -SourceFile } description="The file object that this Editable instance belongs to." /> - -### file_node_id - -NodeId } description=" -" /> +TSFile } description="The file object that this Editable instance belongs to." /> ### filepath @@ -82,29 +68,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements list[ MultiLineCollection [ Statement [ TSWhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> -### node_type - -NodeType } description=" -" /> - ### parent -Editable } description=" -" /> +Editable } description="The parent node of this Editable instance." /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +TSClass | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +TSFunction | None } description="Find the function this node is contained in" /> ### parent_statement @@ -118,16 +98,6 @@ import {Attribute} from '/snippets/Attribute.mdx'; str } description="Text representation of the Editable instance." /> -### statement_type - - } description=" -" /> - -### ts_node - -TSNode } description=" -" /> - ### variable_usages list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> @@ -137,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=""/> @@ -168,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=""/> @@ -257,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_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -387,7 +357,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=""/> @@ -395,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=""/> @@ -403,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. - +