From bf0b6589fb9ce4e2d87c2e3da3bb19c02bcf6e7b Mon Sep 17 00:00:00 2001 From: jemeza-codegen Date: Fri, 24 Jan 2025 16:45:33 -0800 Subject: [PATCH 1/7] added return type annotations, now ignoring internal methods, better error handling --- docs/api-reference/core/Argument.mdx | 70 ++--- docs/api-reference/core/Assignment.mdx | 142 ++++++--- .../core/AssignmentStatement.mdx | 70 ++--- docs/api-reference/core/Attribute.mdx | 113 ++++--- docs/api-reference/core/AwaitExpression.mdx | 62 ++-- docs/api-reference/core/BinaryExpression.mdx | 64 ++-- docs/api-reference/core/BlockStatement.mdx | 70 ++--- docs/api-reference/core/Boolean.mdx | 56 ++-- docs/api-reference/core/Callable.mdx | 117 ++++--- docs/api-reference/core/CatchStatement.mdx | 72 ++--- docs/api-reference/core/ChainedAttribute.mdx | 56 ++-- docs/api-reference/core/Class.mdx | 208 ++++++++----- docs/api-reference/core/CodeBlock.mdx | 137 ++++---- docs/api-reference/core/Codebase.mdx | 121 +++++--- docs/api-reference/core/Comment.mdx | 62 ++-- docs/api-reference/core/CommentGroup.mdx | 62 ++-- .../core/ComparisonExpression.mdx | 64 ++-- docs/api-reference/core/Decorator.mdx | 66 ++-- docs/api-reference/core/Dict.mdx | 58 ++-- docs/api-reference/core/Directory.mdx | 72 +++-- docs/api-reference/core/Editable.mdx | 54 ++-- docs/api-reference/core/Export.mdx | 113 ++++--- docs/api-reference/core/ExportStatement.mdx | 64 ++-- docs/api-reference/core/Exportable.mdx | 103 +++--- docs/api-reference/core/Expression.mdx | 56 ++-- docs/api-reference/core/ExpressionGroup.mdx | 62 ++-- .../core/ExpressionStatement.mdx | 66 ++-- docs/api-reference/core/ExternalModule.mdx | 121 +++++--- docs/api-reference/core/File.mdx | 62 ++-- docs/api-reference/core/FlagKwargs.mdx | 39 +++ docs/api-reference/core/ForLoopStatement.mdx | 72 ++--- docs/api-reference/core/Function.mdx | 195 ++++++++---- docs/api-reference/core/FunctionCall.mdx | 98 +++--- docs/api-reference/core/GenericType.mdx | 66 ++-- docs/api-reference/core/HasBlock.mdx | 64 ++-- docs/api-reference/core/HasName.mdx | 10 +- docs/api-reference/core/HasValue.mdx | 6 +- docs/api-reference/core/IfBlockStatement.mdx | 70 ++--- docs/api-reference/core/Import.mdx | 106 +++---- docs/api-reference/core/ImportStatement.mdx | 62 ++-- docs/api-reference/core/Importable.mdx | 66 ++-- docs/api-reference/core/List.mdx | 64 ++-- docs/api-reference/core/MessageType.mdx | 2 +- docs/api-reference/core/MultiExpression.mdx | 58 ++-- .../core/MultiLineCollection.mdx | 66 ++-- docs/api-reference/core/Name.mdx | 56 ++-- docs/api-reference/core/NamedType.mdx | 64 ++-- docs/api-reference/core/NoneType.mdx | 56 ++-- docs/api-reference/core/Number.mdx | 56 ++-- docs/api-reference/core/Pair.mdx | 58 ++-- docs/api-reference/core/Parameter.mdx | 88 +++--- .../core/ParenthesizedExpression.mdx | 79 +++-- docs/api-reference/core/Placeholder.mdx | 6 +- docs/api-reference/core/PlaceholderType.mdx | 56 ++-- docs/api-reference/core/RaiseStatement.mdx | 64 ++-- docs/api-reference/core/ReturnStatement.mdx | 64 ++-- docs/api-reference/core/SourceFile.mdx | 229 +++++++++----- docs/api-reference/core/Span.mdx | 2 +- docs/api-reference/core/Statement.mdx | 60 ++-- docs/api-reference/core/StatementType.mdx | 2 +- docs/api-reference/core/String.mdx | 60 ++-- docs/api-reference/core/StubPlaceholder.mdx | 6 +- .../core/SubscriptExpression.mdx | 58 ++-- docs/api-reference/core/SwitchCase.mdx | 72 ++--- docs/api-reference/core/SwitchStatement.mdx | 64 ++-- docs/api-reference/core/Symbol.mdx | 130 +++++--- docs/api-reference/core/SymbolGroup.mdx | 60 ++-- docs/api-reference/core/SymbolStatement.mdx | 60 ++-- docs/api-reference/core/TernaryExpression.mdx | 64 ++-- docs/api-reference/core/TryCatchStatement.mdx | 70 ++--- docs/api-reference/core/Tuple.mdx | 64 ++-- docs/api-reference/core/TupleType.mdx | 68 ++-- docs/api-reference/core/Type.mdx | 56 ++-- docs/api-reference/core/TypeAlias.mdx | 150 +++++---- docs/api-reference/core/TypePlaceholder.mdx | 6 +- docs/api-reference/core/Typeable.mdx | 56 ++-- docs/api-reference/core/UnaryExpression.mdx | 58 ++-- docs/api-reference/core/UnionType.mdx | 68 ++-- docs/api-reference/core/Unpack.mdx | 79 +++-- docs/api-reference/core/Unwrappable.mdx | 64 ++-- docs/api-reference/core/Usable.mdx | 99 +++--- docs/api-reference/core/Usage.mdx | 8 +- docs/api-reference/core/UsageKind.mdx | 2 +- docs/api-reference/core/UsageType.mdx | 2 +- docs/api-reference/core/Value.mdx | 56 ++-- docs/api-reference/core/WhileStatement.mdx | 70 ++--- docs/api-reference/core/WithStatement.mdx | 70 ++--- docs/api-reference/python/PyAssignment.mdx | 150 +++++---- .../python/PyAssignmentStatement.mdx | 72 ++--- docs/api-reference/python/PyAttribute.mdx | 119 ++++--- .../api-reference/python/PyBlockStatement.mdx | 70 ++--- .../api-reference/python/PyBreakStatement.mdx | 60 ++-- .../api-reference/python/PyCatchStatement.mdx | 72 ++--- .../python/PyChainedAttribute.mdx | 56 ++-- docs/api-reference/python/PyClass.mdx | 212 +++++++------ docs/api-reference/python/PyCodeBlock.mdx | 143 +++++---- docs/api-reference/python/PyComment.mdx | 66 ++-- docs/api-reference/python/PyCommentGroup.mdx | 64 ++-- docs/api-reference/python/PyCommentType.mdx | 2 +- .../python/PyConditionalExpression.mdx | 64 ++-- docs/api-reference/python/PyDecorator.mdx | 66 ++-- docs/api-reference/python/PyFile.mdx | 242 ++++++++++----- .../python/PyForLoopStatement.mdx | 74 ++--- docs/api-reference/python/PyFunction.mdx | 199 ++++++++---- docs/api-reference/python/PyGenericType.mdx | 66 ++-- docs/api-reference/python/PyHasBlock.mdx | 64 ++-- .../python/PyIfBlockStatement.mdx | 70 ++--- docs/api-reference/python/PyImport.mdx | 108 +++---- .../python/PyImportStatement.mdx | 62 ++-- docs/api-reference/python/PyMatchCase.mdx | 72 ++--- .../api-reference/python/PyMatchStatement.mdx | 64 ++-- docs/api-reference/python/PyNamedType.mdx | 64 ++-- docs/api-reference/python/PyParameter.mdx | 90 +++--- docs/api-reference/python/PyPassStatement.mdx | 60 ++-- .../python/PyReturnTypePlaceholder.mdx | 6 +- docs/api-reference/python/PyString.mdx | 60 ++-- docs/api-reference/python/PySymbol.mdx | 134 +++++--- .../python/PyTryCatchStatement.mdx | 74 ++--- docs/api-reference/python/PyUnionType.mdx | 68 ++-- .../api-reference/python/PyWhileStatement.mdx | 72 ++--- docs/api-reference/typescript/JSXElement.mdx | 80 ++--- .../typescript/JSXExpression.mdx | 66 ++-- docs/api-reference/typescript/JSXProp.mdx | 70 ++--- docs/api-reference/typescript/TSArrayType.mdx | 64 ++-- .../api-reference/typescript/TSAssignment.mdx | 154 +++++---- .../typescript/TSAssignmentStatement.mdx | 70 ++--- docs/api-reference/typescript/TSAttribute.mdx | 117 ++++--- .../typescript/TSBlockStatement.mdx | 76 ++--- .../typescript/TSCatchStatement.mdx | 78 ++--- .../typescript/TSChainedAttribute.mdx | 56 ++-- docs/api-reference/typescript/TSClass.mdx | 226 ++++++++------ docs/api-reference/typescript/TSCodeBlock.mdx | 137 ++++---- docs/api-reference/typescript/TSComment.mdx | 66 ++-- .../typescript/TSCommentGroup.mdx | 62 ++-- .../typescript/TSCommentType.mdx | 2 +- .../typescript/TSConditionalType.mdx | 64 ++-- docs/api-reference/typescript/TSConfig.mdx | 12 +- docs/api-reference/typescript/TSDecorator.mdx | 66 ++-- docs/api-reference/typescript/TSDict.mdx | 58 ++-- docs/api-reference/typescript/TSEnum.mdx | 160 ++++++---- docs/api-reference/typescript/TSExport.mdx | 139 +++++---- .../typescript/TSExpressionType.mdx | 66 ++-- docs/api-reference/typescript/TSFile.mdx | 292 ++++++++++++------ .../typescript/TSForLoopStatement.mdx | 86 +++--- docs/api-reference/typescript/TSFunction.mdx | 215 ++++++++----- .../typescript/TSFunctionType.mdx | 62 ++-- .../typescript/TSGenericType.mdx | 66 ++-- docs/api-reference/typescript/TSHasBlock.mdx | 70 ++--- .../typescript/TSIfBlockStatement.mdx | 70 ++--- docs/api-reference/typescript/TSImport.mdx | 118 +++---- .../typescript/TSImportStatement.mdx | 62 ++-- docs/api-reference/typescript/TSInterface.mdx | 168 ++++++---- .../typescript/TSLabeledStatement.mdx | 70 ++--- .../api-reference/typescript/TSLookupType.mdx | 58 ++-- docs/api-reference/typescript/TSNamedType.mdx | 64 ++-- docs/api-reference/typescript/TSNamespace.mdx | 169 +++++----- .../api-reference/typescript/TSObjectType.mdx | 58 ++-- docs/api-reference/typescript/TSPair.mdx | 58 ++-- docs/api-reference/typescript/TSParameter.mdx | 90 +++--- docs/api-reference/typescript/TSQueryType.mdx | 58 ++-- .../typescript/TSReadonlyType.mdx | 58 ++-- .../typescript/TSReturnTypePlaceholder.mdx | 6 +- docs/api-reference/typescript/TSString.mdx | 60 ++-- .../api-reference/typescript/TSSwitchCase.mdx | 78 ++--- .../typescript/TSSwitchStatement.mdx | 64 ++-- docs/api-reference/typescript/TSSymbol.mdx | 138 ++++++--- .../typescript/TSTernaryExpression.mdx | 64 ++-- .../typescript/TSTryCatchStatement.mdx | 80 ++--- docs/api-reference/typescript/TSTypeAlias.mdx | 164 ++++++---- .../typescript/TSUndefinedType.mdx | 56 ++-- docs/api-reference/typescript/TSUnionType.mdx | 68 ++-- .../typescript/TSWhileStatement.mdx | 76 ++--- docs/mint.json | 1 + .../doc_utils/generate_docs_json.py | 77 +++-- .../sdk/code_generation/doc_utils/utils.py | 70 +++-- .../code_generation/mdx_docs_generation.py | 2 +- src/codegen/sdk/codebase/flagging/enums.py | 8 + src/codegen/sdk/core/directory.py | 2 +- .../expressions/parenthesized_expression.py | 2 +- src/codegen/sdk/core/expressions/unpack.py | 2 +- src/codegen/sdk/core/file.py | 10 +- src/codegen/sdk/core/function.py | 5 +- .../sdk/core/interfaces/unwrappable.py | 2 +- src/codegen/sdk/core/interfaces/usable.py | 3 +- .../sdk/core/statements/for_loop_statement.py | 5 +- src/codegen/sdk/core/symbol.py | 2 +- .../detached_symbols/jsx/expression.py | 2 +- src/codegen/sdk/typescript/file.py | 2 +- src/codegen/sdk/typescript/function.py | 12 + 189 files changed, 7614 insertions(+), 6140 deletions(-) create mode 100644 docs/api-reference/core/FlagKwargs.mdx diff --git a/docs/api-reference/core/Argument.mdx b/docs/api-reference/core/Argument.mdx index 8a293a313..4a7f74900 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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of function calls present in the value of this argument." /> +list[ FunctionCall ] } description="Returns a list of function calls present in the value of this argument." /> ### index @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -100,18 +100,18 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Argument ] } description=""/> +CodeFlag[ Argument ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +346,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -362,7 +362,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -31,11 +31,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -43,7 +43,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -68,7 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -76,7 +76,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> ### is_local_variable @@ -102,19 +102,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -132,22 +132,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +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. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Assignment ] } description=""/> +CodeFlag[ Assignment ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -388,15 +405,15 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + -list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> +list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/AssignmentStatement.mdx b/docs/api-reference/core/AssignmentStatement.mdx index 90aeb8483..c82689d1a 100644 --- a/docs/api-reference/core/AssignmentStatement.mdx +++ b/docs/api-reference/core/AssignmentStatement.mdx @@ -16,7 +16,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), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,7 +25,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### extended @@ -51,7 +51,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -59,16 +59,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ AssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ AssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -82,23 +82,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -117,26 +117,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ AssignmentStatement ] } description=""/> +CodeFlag[ AssignmentStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +338,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -354,7 +354,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -25,12 +25,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### name @@ -84,11 +84,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ Attribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ Attribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -102,23 +102,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -137,26 +137,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Attribute ] } description=""/> +CodeFlag[ Attribute ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +366,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -382,7 +382,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/AwaitExpression.mdx b/docs/api-reference/core/AwaitExpression.mdx index 71a434e3d..622c2445d 100644 --- a/docs/api-reference/core/AwaitExpression.mdx +++ b/docs/api-reference/core/AwaitExpression.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), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the await expression." /> +list[ FunctionCall ] } description="Gets all function calls within the await expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -80,26 +80,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ AwaitExpression ] } description=""/> +CodeFlag[ AwaitExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +301,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -395,7 +395,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### elements -list[ Expression [ BinaryExpression ]] } description="Returns all elements in a binary expression chain." /> +list[ Expression [ BinaryExpression ]] } description="Returns all elements in a binary expression chain." /> ### extended @@ -45,11 +45,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### left -Expression [ ComparisonExpression ] | None } description=" +Expression [ ComparisonExpression ] | None } description=" " /> ### node_type @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### operators -list[ ExpressionGroup [ Expression [ BinaryExpression ], BinaryExpression ]] } description="Returns a list of operators in a chain of binary operations." /> +list[ ExpressionGroup [ Expression [ BinaryExpression ], BinaryExpression ]] } description="Returns a list of operators in a chain of binary operations." /> ### parent @@ -68,23 +68,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ ComparisonExpression ] | None } description=" +Expression [ ComparisonExpression ] | None } description=" " /> ### source @@ -98,22 +98,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ BinaryExpression ] } description=""/> +CodeFlag[ BinaryExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +315,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/BlockStatement.mdx b/docs/api-reference/core/BlockStatement.mdx index 4e922362a..bff7e80d9 100644 --- a/docs/api-reference/core/BlockStatement.mdx +++ b/docs/api-reference/core/BlockStatement.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,16 +20,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -66,11 +66,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ BlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ BlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -84,19 +84,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -114,14 +114,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ BlockStatement ] } description=""/> +CodeFlag[ BlockStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +354,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -370,7 +370,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -83,22 +83,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Boolean ] } description=""/> +CodeFlag[ Boolean ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +300,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -316,7 +316,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Callable.mdx b/docs/api-reference/core/Callable.mdx index bba80ecda..14c209957 100644 --- a/docs/api-reference/core/Callable.mdx +++ b/docs/api-reference/core/Callable.mdx @@ -14,7 +14,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -23,11 +23,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -69,7 +69,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , Callable ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , Callable ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -78,23 +78,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -108,22 +108,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Callable ] } description=""/> +CodeFlag[ Callable ] } 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."/> +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_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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +384,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -400,7 +400,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/CatchStatement.mdx b/docs/api-reference/core/CatchStatement.mdx index 199936f11..6f680d853 100644 --- a/docs/api-reference/core/CatchStatement.mdx +++ b/docs/api-reference/core/CatchStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [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) @@ -25,20 +25,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> +Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -63,7 +63,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -75,11 +75,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ CatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ CatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -93,19 +93,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -123,14 +123,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ CatchStatement ] } description=""/> +CodeFlag[ CatchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +363,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -379,7 +379,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ChainedAttribute ] } description=""/> +CodeFlag[ ChainedAttribute ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +313,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Class.mdx b/docs/api-reference/core/Class.mdx index 99718c16d..d751d609e 100644 --- a/docs/api-reference/core/Class.mdx +++ b/docs/api-reference/core/Class.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -28,11 +28,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> ### constructor -Function | None } description="Returns the constructor method for this class." /> +Function | None } description="Returns the constructor method for this class." /> ### constructor_keyword @@ -41,15 +41,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +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." /> +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." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -82,11 +82,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +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." /> +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> ### is_decorated @@ -102,7 +102,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_classes -list[ Class ] } description="Retrieves the nested classes defined within this class." /> +list[ Class ] } description="Retrieves the nested classes defined within this class." /> ### node_type @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , Class ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , Class ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -120,32 +120,32 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | 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 | ChainedAttribute ] } 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=" " /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -164,19 +164,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### 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[ 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."/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Class ] } description=""/> +CodeFlag[ Class ] } description=""/> ### 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."/> +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."/> ### 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."/> +Function | None } description="The method if found, None otherwise."/> ### 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."/> +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_nested_class Returns a nested class by name from the current class. - + -Class | None } description="The nested class if found, None otherwise."/> +Class | None } description="The nested class if found, None otherwise."/> ### 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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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. - + -Editable | None } description="The matching parent class node, or None if no match is found."/> +Editable | None } description="The matching parent class node, or None if no match is found."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 | Class } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" /> @@ -654,7 +671,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=""/> @@ -662,7 +679,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 , Class ] } description=""/> +list[ Function ] | MultiLineCollection [ Function , Class ] } description=""/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -736,7 +753,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + -list[ Class ] } description="A list of Class objects that inherit from this class."/> +list[ Class ] } 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[ 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."/> ### symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/CodeBlock.mdx b/docs/api-reference/core/CodeBlock.mdx index 20b0b22c1..6ea254436 100644 --- a/docs/api-reference/core/CodeBlock.mdx +++ b/docs/api-reference/core/CodeBlock.mdx @@ -15,7 +15,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) @@ -24,19 +24,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignment_statements -list[ AssignmentStatement [ CodeBlock , Assignment ]] } description="Returns list of top level assignment statements in the code block." /> +list[ AssignmentStatement [ CodeBlock , Assignment ]] } description="Returns list of top level assignment statements in the code block." /> ### assignments -list[ Assignment [ Editable , CodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> +list[ Assignment [ Editable , CodeBlock ]] } description="Returns all assignments in the code block across all nesting levels." /> ### attributes -list[ Attribute [ Editable , CodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> +list[ Attribute [ Editable , CodeBlock ]] } description="Returns a list of top level class attribute statements in the code block." /> ### comments -list[ Comment [ Editable , CodeBlock ]] } description="Gets list of top level comments in the code block." /> +list[ Comment [ Editable , CodeBlock ]] } description="Gets list of top level comments in the code block." /> ### extended @@ -61,11 +61,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> +list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> ### if_blocks -list[ IfBlockStatement [ CodeBlock ]] } description="Returns a list of top level if statements in the code block." /> +list[ IfBlockStatement [ CodeBlock ]] } description="Returns a list of top level if statements in the code block." /> ### level @@ -74,7 +74,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### local_var_assignments -list[ Assignment [ Editable , CodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> +list[ Assignment [ Editable , CodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> ### node_type @@ -88,28 +88,28 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement [ CodeBlock ]] } description="Gets all return statements at the top level of the code block." /> +list[ ReturnStatement [ CodeBlock ]] } description="Gets all return statements at the top level of the code block." /> ### source @@ -117,11 +117,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### statements -MultiLineCollection [ Statement , CodeBlock ] } description="Gets a view of the top-level statements in the code block." /> +MultiLineCollection [ Statement , CodeBlock ] } description="Gets a view of the top-level statements in the code block." /> ### symbol_statements -list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> +list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> ### ts_node @@ -130,22 +130,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ CodeBlock ] } description=""/> +CodeFlag[ CodeBlock ] } description=""/> ### get_assignments Returns a list of assignments with the specified variable name. - + -list[ Assignment [ Editable , CodeBlock ]] } description="A list of Assignment objects that match the variable name."/> +list[ Assignment [ Editable , CodeBlock ]] } 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 , CodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> +list[ Attribute [ Editable , CodeBlock ]] } description="A list of attribute statements matching the privacy criteria."/> ### get_comment Gets the first comment statement containing a specific text string. - + -Comment [ Editable , CodeBlock ] | None } description="The first comment statement containing the search text, or None if no matching comment is found."/> +Comment [ Editable , CodeBlock ] | 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 , CodeBlock ] | None } description="The first matching local variable assignment, or None if no match is found."/> +Assignment [ Editable , CodeBlock ] | 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 , CodeBlock ]] } description="List of Assignment objects representing local variable assignments that match the specified name criteria."/> +list[ Assignment [ Editable , CodeBlock ]] } 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. - + StatementType | None } + type={ <>StatementType | None } description="The type of statements to return. If None, returns all statement types." defaultValue="None" /> @@ -343,12 +343,12 @@ Returns all statements of a given type up to the specified block level. -list[ Statement [ CodeBlock ]] } description=""/> +list[ Statement [ CodeBlock ]] } description=""/> ### get_variable_usages Returns all instances of variable usages in a code block. - + -list[ Editable [ CodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> +list[ Editable [ CodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> ### indent Adjusts the indentation level of the entire code block. - + None } description=""/> +### insert_after +Inserts source code at the bottom of the code block. + + + +str } + description="The source code to insert." + defaultValue="" +/> +bool } + description="Whether to fix the indentation of the inserted code. Defaults to True." + defaultValue="True" +/> +bool } + description="Whether to add a newline before the inserted code. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + ### 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=""/> @@ -413,15 +442,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -429,7 +458,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### unwrap Extracts a code block from its parent wrapper container by removing the wrapping - + None } description=""/> @@ -565,7 +594,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 ### classes -list[ Class ] } description="List of all Classes in the codebase." /> +list[ Class ] } description="List of all Classes in the codebase." /> ### console @@ -38,23 +38,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### directories -list[ Directory ] } description="List all directories in the codebase." /> +list[ Directory ] } description="List all directories in the codebase." /> ### external_modules -list[ ExternalModule ] } description="Returns a list of all external modules in the codebase." /> +list[ ExternalModule ] } description="Returns a list of all external modules in the codebase." /> ### functions -list[ Function ] } description="List of all Functions in the codebase." /> +list[ Function ] } description="List of all Functions in the codebase." /> ### global_vars -list[ Assignment ] } description="List of all GlobalVars in the codebase." /> +list[ Assignment ] } description="List of all GlobalVars in the codebase." /> ### imports -list[ Import ] } description="Returns a list of all Import nodes in the codebase." /> +list[ Import ] } description="Returns a list of all Import nodes in the codebase." /> ### interfaces @@ -75,11 +75,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Symbol ] } description="List of all top-level Symbols (Classes, Functions, etc.) in the codebase. Excludes Class" /> +list[ Symbol ] } description="List of all top-level Symbols (Classes, Functions, etc.) in the codebase. Excludes Class" /> ### types -list[ TypeAlias ] } description="List of all Types in the codebase (Typescript only)." /> +list[ TypeAlias ] } description="List of all Types in the codebase (Typescript only)." /> ### viz @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ai Generates a response from the AI based on the provided prompt, target, and context. - + Editable | None } + type={ <>Editable | None } description="An optional editable object (like a function, class, etc.) that provides the main focus for the AI's response." defaultValue="None" /> Editable | list[ Editable ] | dict[str, Editable | list[ Editable ]] | None } + type={ <>Editable | list[ Editable ] | dict[str, Editable | list[ Editable ]] | None } description="Additional context to help inform the AI's response." defaultValue="None" /> @@ -126,7 +126,7 @@ Generates a response from the AI based on the provided prompt, target, and conte ### 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. - + 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."/> +list[ SourceFile ] | list[ File ] } description="A sorted list of source files in the codebase."/> ### find_by_span Finds editable objects that overlap with the given source code span. - + -list[ Editable ] } description="A list of Editable objects that overlap with the given span."/> +list[ Editable ] } description="A list of Editable objects that overlap with the given span."/> + + +### from_repo +Fetches a codebase from GitHub and returns a Codebase instance. + + + +str } + description="The name of the repository in format "owner/repo"" + defaultValue="" +/> +Optional[str] } + description="The directory to clone the repo into. Defaults to /tmp/codegen" + defaultValue="None" +/> +Optional[str] } + description="The specific commit hash to clone. Defaults to HEAD" + defaultValue="None" +/> +bool } + description="Whether to do a shallow clone. Defaults to True" + defaultValue="True" +/> + + + +Codebase } description="A Codebase instance initialized with the cloned repository"/> ### get_class Returns a class that matches the given name. - + -Class | None } description="The class with the given name, or None if optional=True and class not found."/> +Class | None } description="The class with the given name, or None if optional=True and class not found."/> ### get_directory Returns Directory by `dir_path`, or full path to the directory from codebase root. - + -Directory | None } description="The Directory object if found, None if optional=True and directory not found."/> +Directory | None } description="The Directory object if found, None if optional=True and directory not found."/> ### get_file Retrieves a file from the codebase by its filepath. - + -SourceFile | None } description="The source file if found, None if optional=True and file not found."/> +SourceFile | None } description="The source file if found, None if optional=True and file not found."/> ### get_function Retrieves a function from the codebase by its name. - + -Function | None } description="The matching function if found. If optional=True and no match is found, returns None."/> +Function | None } description="The matching function if found. If optional=True and no match is found, returns None."/> ### 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. - + -Symbol | None } description="The matched Symbol if found, None if not found and optional=True."/> +Symbol | None } description="The matched Symbol if found, None if not found and optional=True."/> ### get_symbols Retrieves all symbols in the codebase that match the given symbol name. - + -list[ Symbol ] } description="A list of Symbol objects that match the given name, sorted alphabetically."/> +list[ Symbol ] } description="A list of Symbol objects that match the given name, sorted alphabetically."/> ### 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=""/> @@ -510,7 +545,7 @@ Resets the codebase by ### set_ai_key Sets the OpenAI key for the current Codebase instance. - + None } description=""/> @@ -518,7 +553,7 @@ Sets the OpenAI key for the current Codebase instance. ### set_session_options Sets the Session options for the current codebase. - + None } description=""/> @@ -526,7 +561,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. - + Editable | str | int | None } + type={ <>Editable | str | int | None } description="The root node to visualize around. When specified, the visualization will be centered on this node. Defaults to None." defaultValue="None" /> diff --git a/docs/api-reference/core/Comment.mdx b/docs/api-reference/core/Comment.mdx index 5bb7e69b7..d7c375bf0 100644 --- a/docs/api-reference/core/Comment.mdx +++ b/docs/api-reference/core/Comment.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 [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -49,11 +49,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> +list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ Comment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ Comment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -101,22 +101,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Comment ] } description=""/> +CodeFlag[ Comment ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +335,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -351,7 +351,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/CommentGroup.mdx b/docs/api-reference/core/CommentGroup.mdx index c6476eb51..bbeb2fe2a 100644 --- a/docs/api-reference/core/CommentGroup.mdx +++ b/docs/api-reference/core/CommentGroup.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 [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -41,15 +41,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -63,15 +63,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### text @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ CommentGroup ] } description=""/> +CodeFlag[ CommentGroup ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -326,15 +326,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -342,7 +342,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/ComparisonExpression.mdx b/docs/api-reference/core/ComparisonExpression.mdx index 19ffb2fb9..c00f1c5f6 100644 --- a/docs/api-reference/core/ComparisonExpression.mdx +++ b/docs/api-reference/core/ComparisonExpression.mdx @@ -14,7 +14,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [BinaryExpression](/api-reference/core/BinaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### elements -list[ Expression [ ComparisonExpression ]] } description="Returns a list of expressions for named child nodes." /> +list[ Expression [ ComparisonExpression ]] } description="Returns a list of expressions for named child nodes." /> ### extended @@ -48,11 +48,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### left -Expression [ ComparisonExpression ] | None } description=" +Expression [ ComparisonExpression ] | None } description=" " /> ### node_type @@ -62,7 +62,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### operators -list[ ExpressionGroup [ Expression [ ComparisonExpression ], ComparisonExpression ]] } description="Returns a list of operator expressions in a comparison expression." /> +list[ ExpressionGroup [ Expression [ ComparisonExpression ], ComparisonExpression ]] } description="Returns a list of operator expressions in a comparison expression." /> ### parent @@ -71,23 +71,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ ComparisonExpression ] | None } description=" +Expression [ ComparisonExpression ] | None } description=" " /> ### source @@ -101,22 +101,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ComparisonExpression ] } description=""/> +CodeFlag[ ComparisonExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +318,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Decorator.mdx b/docs/api-reference/core/Decorator.mdx index a5faa770a..ea6795fca 100644 --- a/docs/api-reference/core/Decorator.mdx +++ b/docs/api-reference/core/Decorator.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call -FunctionCall | None } description="Returns any function call made by this decorator." /> +FunctionCall | None } description="Returns any function call made by this decorator." /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Decorator ] } description=""/> +CodeFlag[ Decorator ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +317,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -83,27 +83,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### unpack -Unpack [ TSObjectType ] | None } description=" +Unpack [ TSObjectType ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Dict ] } description=""/> +CodeFlag[ Dict ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +305,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Directory.mdx b/docs/api-reference/core/Directory.mdx index 7964db3d9..a8292e7b4 100644 --- a/docs/api-reference/core/Directory.mdx +++ b/docs/api-reference/core/Directory.mdx @@ -13,14 +13,14 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes ### classes -list[ Class ] } description="Get a recursive list of all classes in the directory and its subdirectories." /> +list[ Class ] } description="Get a recursive list of all classes in the directory and its subdirectories." /> ### dirpath @@ -29,23 +29,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### files -list[ File ] } description="Get a recursive list of all files in the directory and its subdirectories." /> +list[ File ] } description="Get a recursive list of all files in the directory and its subdirectories." /> ### functions -list[ Function ] } description="Get a recursive list of all functions in the directory and its subdirectories." /> +list[ Function ] } description="Get a recursive list of all functions in the directory and its subdirectories." /> ### global_vars -list[ Assignment ] } description="Get a recursive list of all global variables in the directory and its subdirectories." /> +list[ Assignment ] } description="Get a recursive list of all global variables in the directory and its subdirectories." /> ### import_statements -list[ ImportStatement ] } description="Get a recursive list of all import statements in the directory and its subdirectories." /> +list[ ImportStatement ] } description="Get a recursive list of all import statements in the directory and its subdirectories." /> ### items -dict[str, File | Directory ] } description=" +dict[str, File | Directory ] } description=" " /> ### name @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent -Directory | None } description=" +Directory | None } description=" " /> ### path @@ -64,18 +64,18 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### subdirectories -list[ Directory ] } description="Get a recursive list of all subdirectories in the directory and its subdirectories." /> +list[ Directory ] } description="Get a recursive list of all subdirectories in the directory and its subdirectories." /> ### symbols -list[ Symbol ] } description="Get a recursive list of all symbols in the directory and its subdirectories." /> +list[ Symbol ] } description="Get a recursive list of all symbols in the directory and its subdirectories." /> ## Methods ### add_file Add a file to the directory. - + None } description=""/> @@ -83,7 +83,7 @@ Add a file to the directory. ### add_subdirectory Add a subdirectory to the directory. - + None } description=""/> @@ -91,63 +91,71 @@ Add a subdirectory to the directory. ### get_class Get a class by name in the directory and its subdirectories. - + -Class | None } description=""/> +Class | None } description=""/> ### get_file Get a file by its name relative to the directory. - + -File | None } description=""/> +File | None } description=""/> ### get_function Get a function by name in the directory and its subdirectories. - + -Function | None } description=""/> +Function | None } description=""/> ### get_global_var Get a global variable by name in the directory and its subdirectories. - + -Assignment | None } description=""/> +Assignment | None } description=""/> ### get_import_statement Get an import statement by name in the directory and its subdirectories. - + -ImportStatement | None } description=""/> +ImportStatement | None } description=""/> ### get_subdirectory Get a subdirectory by its path relative to the directory. - + -Directory | None } description=""/> +Directory | None } description=""/> ### get_symbol Get a symbol by name in the directory and its subdirectories. - + -Symbol | None } description=""/> +Symbol | None } description=""/> + + +### remove +Remove the directory and all its files and subdirectories. + + + +None } description=""/> ### remove_file Remove a file from the directory. - + None } description=""/> @@ -155,7 +163,7 @@ Remove a file from the directory. ### remove_file_by_path Remove a file from the directory by its path. - + None } description=""/> @@ -163,7 +171,7 @@ Remove a file from the directory by its path. ### remove_subdirectory Remove a subdirectory from the directory. - + None } description=""/> @@ -171,7 +179,7 @@ Remove a subdirectory from the directory. ### remove_subdirectory_by_path Remove a subdirectory from the directory by its path. - + None } description=""/> @@ -179,7 +187,7 @@ Remove a subdirectory from the directory by its path. ### rename Rename the directory. - + None } description=""/> @@ -187,7 +195,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 d66e52a02..fbb7da55c 100644 --- a/docs/api-reference/core/Editable.mdx +++ b/docs/api-reference/core/Editable.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -43,7 +43,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -57,15 +57,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -78,22 +78,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Editable ] } description=""/> +CodeFlag[ Editable ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +295,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -311,7 +311,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Export.mdx b/docs/api-reference/core/Export.mdx index 78a2de6b7..689c58439 100644 --- a/docs/api-reference/core/Export.mdx +++ b/docs/api-reference/core/Export.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 [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) @@ -20,11 +20,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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### export_statement @@ -37,7 +37,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### exported_symbol -Exportable | None } description="Returns the symbol, file, or import being exported from this export object." /> +Exportable | None } description="Returns the symbol, file, or import being exported from this export object." /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### is_exported @@ -92,23 +92,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_symbol -Exportable | None } description="Returns the resolved symbol for an export." /> +Exportable | None } description="Returns the resolved symbol for an export." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -121,22 +121,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Export ] } description=""/> +CodeFlag[ Export ] } description=""/> ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 +381,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 +389,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 +397,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,15 +405,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -421,7 +421,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/ExportStatement.mdx b/docs/api-reference/core/ExportStatement.mdx index 7d254a663..fd908711b 100644 --- a/docs/api-reference/core/ExportStatement.mdx +++ b/docs/api-reference/core/ExportStatement.mdx @@ -16,7 +16,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) @@ -25,7 +25,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### exports -Collection[ Export , ExportStatement ] } description="A list of the individual exports this statement represents" /> +Collection[ Export , ExportStatement ] } description="A list of the individual exports this statement represents" /> ### extended @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -58,11 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ ExportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ ExportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -76,23 +76,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### reexports -list[ TSExport ] } description="Retrieves a list of re-exported symbols from this export statement." /> +list[ TSExport ] } description="Retrieves a list of re-exported symbols from this export statement." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -110,22 +110,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ExportStatement ] } description=""/> +CodeFlag[ ExportStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +327,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -343,7 +343,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Exportable.mdx b/docs/api-reference/core/Exportable.mdx index 39b6b2a87..69f3cfb4f 100644 --- a/docs/api-reference/core/Exportable.mdx +++ b/docs/api-reference/core/Exportable.mdx @@ -13,7 +13,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -22,11 +22,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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### is_exported @@ -85,19 +85,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -110,22 +110,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Exportable ] } description=""/> +CodeFlag[ Exportable ] } description=""/> ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +370,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -386,7 +386,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/Expression.mdx b/docs/api-reference/core/Expression.mdx index ba9b43e5f..53f0442c6 100644 --- a/docs/api-reference/core/Expression.mdx +++ b/docs/api-reference/core/Expression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -80,22 +80,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Expression ] } description=""/> +CodeFlag[ Expression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +297,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/ExpressionGroup.mdx b/docs/api-reference/core/ExpressionGroup.mdx index 70ff37242..3e8418820 100644 --- a/docs/api-reference/core/ExpressionGroup.mdx +++ b/docs/api-reference/core/ExpressionGroup.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 [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### expressions -list[ Expression ] } description="Returns all expressions in the group." /> +list[ Expression ] } description="Returns all expressions in the group." /> ### extended @@ -45,15 +45,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the expression group." /> +list[ FunctionCall ] } description="Returns all function calls within the expression group." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -67,15 +67,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ ExpressionGroup ] } description=""/> +CodeFlag[ ExpressionGroup ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,15 +309,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/ExpressionStatement.mdx b/docs/api-reference/core/ExpressionStatement.mdx index 5419ab447..c7ef5abe0 100644 --- a/docs/api-reference/core/ExpressionStatement.mdx +++ b/docs/api-reference/core/ExpressionStatement.mdx @@ -26,7 +26,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), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Get all function calls contained within this expression statement." /> +list[ FunctionCall ] } description="Get all function calls contained within this expression statement." /> ### index @@ -64,11 +64,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ ExpressionStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ ExpressionStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -82,19 +82,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -112,26 +112,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ExpressionStatement ] } description=""/> +CodeFlag[ ExpressionStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +333,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -349,7 +349,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -427,7 +427,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Callable](/api-reference/core/Callable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -25,11 +25,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -list[ Parameter ] } description="Returns list of named parameters from an external function symbol." /> +list[ Parameter ] } description="Returns list of named parameters from an external function symbol." /> ### parent @@ -80,23 +80,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -110,22 +110,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ExternalModule ] } description=""/> +CodeFlag[ ExternalModule ] } description=""/> ### from_import Creates an ExternalModule instance from an Import instance. - + get_import_string Returns the import string used to import this module. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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_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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +438,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -454,7 +454,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/File.mdx b/docs/api-reference/core/File.mdx index e0d0adbfa..4de657e5f 100644 --- a/docs/api-reference/core/File.mdx +++ b/docs/api-reference/core/File.mdx @@ -14,7 +14,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -27,7 +27,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### directory -Directory | None } description="Returns the directory that contains this file." /> +Directory | None } description="Returns the directory that contains this file." /> ### extended @@ -61,7 +61,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### is_binary @@ -88,15 +88,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### path @@ -118,22 +118,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ File ] } description=""/> +CodeFlag[ File ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +335,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### parse Parses the file representation into the graph. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -368,7 +368,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -376,7 +376,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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### update_filepath Updates the file path and inbound imports of a file. - + + + +## Attributes + +### message + +ReadOnly[str | None] } description="The message to be displayed in the diff preview or posted as a comment on the PR." /> + +### message_recipient + +ReadOnly[str | None] } description="The recipient of the message." /> + +### message_type + +ReadOnly[ MessageType ] } description="Where the message will be sent (CODEGEN, GITHUB, SLACK)" /> + + + diff --git a/docs/api-reference/core/ForLoopStatement.mdx b/docs/api-reference/core/ForLoopStatement.mdx index 1ce2fb51c..2805591c5 100644 --- a/docs/api-reference/core/ForLoopStatement.mdx +++ b/docs/api-reference/core/ForLoopStatement.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Expression](/api-reference/core/Expression), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable) @@ -28,11 +28,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### index @@ -69,21 +69,21 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### item -Expression [ ForLoopStatement ] | None } description=" +Expression [ ForLoopStatement ] | None } description=" " /> ### iterable -Expression [ ForLoopStatement ] } description=" +Expression [ ForLoopStatement ] } description=" " /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ ForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ ForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -97,19 +97,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -127,14 +127,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ForLoopStatement ] } description=""/> +CodeFlag[ ForLoopStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +367,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -383,7 +383,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -32,19 +32,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> +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." /> +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." /> +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." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -52,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -77,7 +77,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> +list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> ### function_signature @@ -89,7 +89,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> ### is_async @@ -129,7 +129,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_functions -list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> +list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> ### node_type @@ -138,7 +138,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , Function ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , Function ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -147,27 +147,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> +list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -186,19 +186,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +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. - + add_decorator Adds a decorator to a function or method. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -271,7 +288,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Function ] } description=""/> +CodeFlag[ Function ] } 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."/> +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_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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + None } description=""/> +### insert_statements +Inserts lines of code into the function body at the specified index. + + + +str } + description="The code lines to insert into the function body." + defaultValue="" +/> +int, optional } + description="The position in the function body where the lines should be inserted. Defaults to 0." + defaultValue="0" +/> + + + +None } description=""/> + + ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -538,7 +578,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=""/> +Editable | None } description=""/> ### prepend_statements Prepends the provided code to the beginning of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -600,7 +640,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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."/> + + ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/FunctionCall.mdx b/docs/api-reference/core/FunctionCall.mdx index 28dda8785..b8ac1c5fa 100644 --- a/docs/api-reference/core/FunctionCall.mdx +++ b/docs/api-reference/core/FunctionCall.mdx @@ -16,7 +16,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) @@ -25,15 +25,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### args -Collection[ Argument , FunctionCall ] } description="Returns a list of arguments passed into the function invocation." /> +Collection[ Argument , FunctionCall ] } description="Returns a list of arguments passed into the function invocation." /> ### base -Editable | None } description="Returns the base object of this function call chain." /> +Editable | None } description="Returns the base object of this function call chain." /> ### call_chain -list[ FunctionCall ] } description="Returns a list of all function calls in this function call chain, including this call. Does not include calls made after this one." /> +list[ FunctionCall ] } description="Returns a list of all function calls in this function call chain, including this call. Does not include calls made after this one." /> ### extended @@ -62,15 +62,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this function call." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this function call." /> ### function_definition -Callable | None } description="Returns the resolved function definition that is being called." /> +Callable | None } description="Returns the resolved function definition that is being called." /> ### function_definitions -list[ Callable ] } description="Returns a list of callable objects that could potentially be the target of this function" /> +list[ Callable ] } description="Returns a list of callable objects that could potentially be the target of this function" /> ### is_awaited @@ -92,23 +92,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Retrieves the parent function of the current function call." /> +Function | None } description="Retrieves the parent function of the current function call." /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### predecessor -FunctionCall [ Editable ] | None } description="Returns the previous function call in a function call chain." /> +FunctionCall [ Editable ] | None } description="Returns the previous function call in a function call chain." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -121,22 +121,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### asyncify Converts the function call to an async function call by wrapping it with 'await'. - + None } description=""/> @@ -144,7 +144,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ FunctionCall ] } description=""/> +CodeFlag[ FunctionCall ] } description=""/> ### from_usage Creates a FunctionCall object from an Editable instance that represents a function call. - + Editable [ Editable ] } + type={ <>Editable [ Editable ] } description="The Editable node that potentially represents a function call." defaultValue="" /> Editable | None } + type={ <>Editable | None } description="The parent node for the new FunctionCall. If None, uses the parent from the input node." defaultValue="None" /> -FunctionCall | None } description="A new FunctionCall object if the input node represents a function call, None otherwise."/> +FunctionCall | None } description="A new FunctionCall object if the input node represents a function call, None otherwise."/> ### get_arg_by_index Returns the Argument with the given index from the function call's argument list. - + -Argument | None } description="The Argument object at the specified index, or None if the index is out of bounds."/> +Argument | None } description="The Argument object at the specified index, or None if the index is out of bounds."/> ### get_arg_by_parameter_name Returns an argument by its parameter name. - + -Argument | None } description="The matching argument if found, None otherwise."/> +Argument | None } description="The matching argument if found, None otherwise."/> ### 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +428,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -444,7 +444,7 @@ Reduces an editable to the following condition ### remove Removes a node and optionally its related extended nodes. - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_kwarg Set a keyword argument in a function call. - + set_name Sets the name of a code element. - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -Collection[ Type , GenericType ] } description="Retrieves the generic type parameters associated with this type." /> +Collection[ Type , GenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ GenericType ] } description=""/> +CodeFlag[ GenericType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +317,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,11 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### is_decorated @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,14 +96,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ HasBlock ] } description=""/> +CodeFlag[ HasBlock ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +336,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + + ## Attributes @@ -29,15 +29,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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."/> ### rename Sets the name of an object and updates all its usages. - + set_name Sets the name of a code element. - + + ## Attributes ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ## Methods ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -33,11 +33,11 @@ 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[ IfBlockStatement ] } 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 [ PyIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> ### consequence_block @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### else_statement -IfBlockStatement | None } description="Returns the else block within the if-statement." /> +IfBlockStatement | None } description="Returns the else block within the if-statement." /> ### extended @@ -70,7 +70,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> +list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> ### index @@ -90,11 +90,11 @@ 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[ CodeBlock ] } description="Returns all nested code blocks within an if/elif/else statement block." /> ### nested_statements -list[ MultiLineCollection [ Statement [ IfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ IfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -108,19 +108,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -138,22 +138,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### 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[ IfBlockStatement ] } 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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ IfBlockStatement ] } description=""/> +CodeFlag[ IfBlockStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +363,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Import.mdx b/docs/api-reference/core/Import.mdx index 3fedbf56d..603fdc7ad 100644 --- a/docs/api-reference/core/Import.mdx +++ b/docs/api-reference/core/Import.mdx @@ -25,7 +25,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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,12 +34,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" +Editable | None } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -64,7 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### from_file -SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> +SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> ### full_name @@ -72,7 +72,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### import_specifier @@ -89,15 +89,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imported_exports -list[ Exportable ] } description="Returns the enumerated list of symbols imported from a module import." /> +list[ Exportable ] } description="Returns the enumerated list of symbols imported from a module import." /> ### imported_symbol -Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> ### module -Editable | None } description=" +Editable | None } description=" " /> ### name @@ -120,23 +120,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_symbol -Symbol | ExternalModule | SourceFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> +Symbol | ExternalModule | SourceFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -144,7 +144,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_name -Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> +Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> ### to_file @@ -162,22 +162,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Import ] } description=""/> +CodeFlag[ Import ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 +387,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 +395,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 +403,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 +411,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 +419,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,15 +427,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -443,7 +443,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/ImportStatement.mdx b/docs/api-reference/core/ImportStatement.mdx index 38338c7fd..a633d5c61 100644 --- a/docs/api-reference/core/ImportStatement.mdx +++ b/docs/api-reference/core/ImportStatement.mdx @@ -16,7 +16,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) @@ -46,11 +46,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -58,11 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ ImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ ImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -76,19 +76,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -106,22 +106,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ImportStatement ] } description=""/> +CodeFlag[ ImportStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +323,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -339,7 +339,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Importable.mdx b/docs/api-reference/core/Importable.mdx index 0fac1ac0e..b513ea1d5 100644 --- a/docs/api-reference/core/Importable.mdx +++ b/docs/api-reference/core/Importable.mdx @@ -14,7 +14,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) @@ -23,7 +23,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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -52,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -70,19 +70,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -95,22 +95,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Importable ] } description=""/> +CodeFlag[ Importable ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +320,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -336,7 +336,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -78,7 +78,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -87,22 +87,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -110,7 +110,7 @@ Edit the source for this Collection instance. ### find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ List ] } description=""/> +CodeFlag[ List ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -195,7 +195,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -203,7 +203,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,15 +293,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -309,12 +309,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -326,7 +326,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/MessageType.mdx b/docs/api-reference/core/MessageType.mdx index da1523ccd..7a577af38 100644 --- a/docs/api-reference/core/MessageType.mdx +++ b/docs/api-reference/core/MessageType.mdx @@ -17,7 +17,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/MultiExpression.mdx b/docs/api-reference/core/MultiExpression.mdx index a1759a847..d1a6a8c16 100644 --- a/docs/api-reference/core/MultiExpression.mdx +++ b/docs/api-reference/core/MultiExpression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### expressions -list[ Expression ] } description=" +list[ Expression ] } description=" " /> ### extended @@ -46,7 +46,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -60,19 +60,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -85,22 +85,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ MultiExpression ] } description=""/> +CodeFlag[ MultiExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +302,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -318,7 +318,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/MultiLineCollection.mdx b/docs/api-reference/core/MultiLineCollection.mdx index 7194928f1..e15c40406 100644 --- a/docs/api-reference/core/MultiLineCollection.mdx +++ b/docs/api-reference/core/MultiLineCollection.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -45,15 +45,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -67,15 +67,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -83,7 +83,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -115,7 +115,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ MultiLineCollection ] } description=""/> +CodeFlag[ MultiLineCollection ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -200,7 +200,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -208,7 +208,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -298,15 +298,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,12 +314,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -331,7 +331,7 @@ Removes an element from a Collection. ### replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/Name.mdx b/docs/api-reference/core/Name.mdx index 34473b06f..60e5f44e3 100644 --- a/docs/api-reference/core/Name.mdx +++ b/docs/api-reference/core/Name.mdx @@ -15,7 +15,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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -59,19 +59,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -84,22 +84,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Name ] } description=""/> +CodeFlag[ Name ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +301,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/NamedType.mdx b/docs/api-reference/core/NamedType.mdx index 23254994f..d185e4623 100644 --- a/docs/api-reference/core/NamedType.mdx +++ b/docs/api-reference/core/NamedType.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 [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -63,19 +63,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -88,22 +88,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ NamedType ] } description=""/> +CodeFlag[ NamedType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +313,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -80,22 +80,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ NoneType ] } description=""/> +CodeFlag[ NoneType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +297,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Number.mdx b/docs/api-reference/core/Number.mdx index f388c002b..6936ee228 100644 --- a/docs/api-reference/core/Number.mdx +++ b/docs/api-reference/core/Number.mdx @@ -14,7 +14,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) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -83,22 +83,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Number ] } description=""/> +CodeFlag[ Number ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +300,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -316,7 +316,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Pair.mdx b/docs/api-reference/core/Pair.mdx index 5f2054ca7..21b8646c8 100644 --- a/docs/api-reference/core/Pair.mdx +++ b/docs/api-reference/core/Pair.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), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### key @@ -64,15 +64,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -85,26 +85,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Pair ] } description=""/> +CodeFlag[ Pair ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +306,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -322,7 +322,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from -[HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Typeable](/api-reference/core/Typeable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) +[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) ## Attributes @@ -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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -87,19 +87,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -112,30 +112,30 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Parameter ] } description=""/> +CodeFlag[ Parameter ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +345,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -361,7 +361,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/ParenthesizedExpression.mdx b/docs/api-reference/core/ParenthesizedExpression.mdx index 19d1b7749..4caf8d32a 100644 --- a/docs/api-reference/core/ParenthesizedExpression.mdx +++ b/docs/api-reference/core/ParenthesizedExpression.mdx @@ -17,7 +17,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) @@ -47,7 +47,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Retrieves a list of function calls within a parenthesized expression." /> +list[ FunctionCall ] } description="Retrieves a list of function calls within a parenthesized expression." /> ### node_type @@ -61,19 +61,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -86,26 +86,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ParenthesizedExpression ] } description=""/> +CodeFlag[ ParenthesizedExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +307,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Simplifies an expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -416,7 +416,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + None } description=""/> +### unwrap +Removes the parentheses from a parenthesized expression node. + + + +Expression | None, optional } + description="The node to unwrap. Defaults to None." + defaultValue="None" +/> + + + +None } description=""/> + + diff --git a/docs/api-reference/core/Placeholder.mdx b/docs/api-reference/core/Placeholder.mdx index 71b3abf4c..7f7641261 100644 --- a/docs/api-reference/core/Placeholder.mdx +++ b/docs/api-reference/core/Placeholder.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Replaces the content of a placeholder node with new source code. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/PlaceholderType.mdx b/docs/api-reference/core/PlaceholderType.mdx index 5d9a5bcf5..95ae10dc1 100644 --- a/docs/api-reference/core/PlaceholderType.mdx +++ b/docs/api-reference/core/PlaceholderType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -80,22 +80,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PlaceholderType ] } description=""/> +CodeFlag[ PlaceholderType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +297,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/RaiseStatement.mdx b/docs/api-reference/core/RaiseStatement.mdx index 149c92607..cbe26b3c7 100644 --- a/docs/api-reference/core/RaiseStatement.mdx +++ b/docs/api-reference/core/RaiseStatement.mdx @@ -17,7 +17,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), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -47,7 +47,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets function calls within a raise statement's value expression." /> +list[ FunctionCall ] } description="Gets function calls within a raise statement's value expression." /> ### index @@ -55,11 +55,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ RaiseStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ RaiseStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -73,19 +73,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -103,26 +103,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ RaiseStatement ] } description=""/> +CodeFlag[ RaiseStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +324,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -340,7 +340,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of function calls contained within this return statement." /> +list[ FunctionCall ] } description="Returns a list of function calls contained within this return statement." /> ### index @@ -58,11 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ ReturnStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ ReturnStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -76,19 +76,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -106,26 +106,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ ReturnStatement ] } description=""/> +CodeFlag[ ReturnStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +327,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -343,7 +343,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ Class ] } description="Returns all Classes in the file." /> +list[ Class ] } description="Returns all Classes in the file." /> ### code_block @@ -37,19 +37,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +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." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### directory -Directory | None } description="Returns the directory that contains this file." /> +Directory | None } description="Returns the directory that contains this file." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -87,15 +87,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### functions -list[ Function ] } description="Returns all Functions in the file." /> +list[ Function ] } description="Returns all Functions in the file." /> ### global_vars -list[ Assignment ] } description="Returns all GlobalVars in the file." /> +list[ Assignment ] } description="Returns all GlobalVars in the file." /> ### import_module_name @@ -103,19 +103,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[ ImportStatement ] } 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[ Import ] } description="Returns all imports that directly imports this file as a module." /> ### imports -list[ Import ] } description="List of all Imports in this file." /> +list[ Import ] } 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[ Import ] } description="Returns all imports that are importing symbols contained in this file." /> ### is_binary @@ -145,15 +145,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### path @@ -162,7 +162,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -174,7 +174,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" /> +list[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> ### ts_node @@ -183,14 +183,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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. - + None } description=""/> +### add_symbol +Adds `symbol` to the file. + + + +Symbol } + description="The symbol to add to the file." + defaultValue="" +/> +bool, optional } + description="Whether to export the symbol. Defaults to True." + defaultValue="True" +/> + + + +Symbol | 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. - + None } description="The symbol is added directly to the file's content."/> +### add_symbol_import +Adds an import to a file for a given symbol. + + + +Symbol } + description="The symbol to import." + defaultValue="" +/> +str | None } + description="Optional alias for the imported symbol. Defaults to None." + defaultValue="None" +/> +ImportType } + description="The type of import to use. Defaults to ImportType.UNKNOWN." + defaultValue="ImportType.UNKNOWN" +/> +bool } + description="Whether this is a type-only import. Defaults to False." + defaultValue="False" +/> + + + +Import | 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +list[ Editable ] } description="A list of Editable instances that match the search criteria."/> ### find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + -list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> +list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> ### find_string_literals Returns a list of string literals within this node's source that match any of the given - + -list[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ SourceFile ] } description=""/> +CodeFlag[ SourceFile ] } description=""/> ### 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."/> +Class | None } description="The matching Class object if found, None otherwise."/> ### get_function Returns a specific Function by name. - + -Function | None } description="The matching Function object if found, None otherwise."/> +Function | 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."/> +Assignment | 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."/> +Import | None } description="The import statement with the matching alias if found, None otherwise."/> ### 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."/> +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_symbol Gets a symbol by its name from the file. - + -Symbol | None } description="The found symbol, or None if not found."/> +Symbol | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -584,15 +642,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -600,15 +658,46 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> +### remove_unused_exports +Removes unused exports from the file. + + + +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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if the file type supports adding the given symbol. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### 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 | 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"/> ### 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. - + UsageType | None } + type={ <>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."/> +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/Span.mdx b/docs/api-reference/core/Span.mdx index b426a2361..ca4f92798 100644 --- a/docs/api-reference/core/Span.mdx +++ b/docs/api-reference/core/Span.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes diff --git a/docs/api-reference/core/Statement.mdx b/docs/api-reference/core/Statement.mdx index 92c6de578..0e02f6946 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) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -49,11 +49,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ Statement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ Statement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -97,22 +97,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Statement ] } description=""/> +CodeFlag[ Statement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/StatementType.mdx b/docs/api-reference/core/StatementType.mdx index f97990147..3e998e7dd 100644 --- a/docs/api-reference/core/StatementType.mdx +++ b/docs/api-reference/core/StatementType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes diff --git a/docs/api-reference/core/String.mdx b/docs/api-reference/core/String.mdx index 80c552eca..189f6947a 100644 --- a/docs/api-reference/core/String.mdx +++ b/docs/api-reference/core/String.mdx @@ -16,7 +16,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 +29,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" +Collection[ Expression [ Editable ], PyString ] } description=" " /> ### 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 @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -73,19 +73,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -98,7 +98,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ### with_quotes @@ -109,15 +109,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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ String ] } description=""/> +CodeFlag[ String ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +319,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -335,7 +335,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/StubPlaceholder.mdx b/docs/api-reference/core/StubPlaceholder.mdx index b0c404895..26b6d8d43 100644 --- a/docs/api-reference/core/StubPlaceholder.mdx +++ b/docs/api-reference/core/StubPlaceholder.mdx @@ -13,7 +13,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the source code of this placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/SubscriptExpression.mdx b/docs/api-reference/core/SubscriptExpression.mdx index da2c6bb46..2b6f19967 100644 --- a/docs/api-reference/core/SubscriptExpression.mdx +++ b/docs/api-reference/core/SubscriptExpression.mdx @@ -15,7 +15,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) @@ -45,11 +45,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### indices -list[ Expression ] } description=" +list[ Expression ] } description=" " /> ### node_type @@ -69,19 +69,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -94,22 +94,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ SubscriptExpression ] } description=""/> +CodeFlag[ SubscriptExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +311,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -327,7 +327,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/SwitchCase.mdx b/docs/api-reference/core/SwitchCase.mdx index de36320fb..fe076d754 100644 --- a/docs/api-reference/core/SwitchCase.mdx +++ b/docs/api-reference/core/SwitchCase.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [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) @@ -25,20 +25,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> +Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -63,7 +63,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -75,11 +75,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ SwitchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ SwitchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -93,19 +93,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -123,14 +123,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ SwitchCase ] } description=""/> +CodeFlag[ SwitchCase ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +363,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -379,7 +379,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### cases -list[ SwitchCase ] } description=" +list[ SwitchCase ] } description=" " /> ### extended @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> +list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> ### index @@ -58,11 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ SwitchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ SwitchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -76,19 +76,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -106,26 +106,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ PyMatchStatement ] } description="The value to switch on" /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ SwitchStatement ] } description=""/> +CodeFlag[ SwitchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +327,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -343,7 +343,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/Symbol.mdx b/docs/api-reference/core/Symbol.mdx index 189b14419..bf512745e 100644 --- a/docs/api-reference/core/Symbol.mdx +++ b/docs/api-reference/core/Symbol.mdx @@ -14,7 +14,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -23,11 +23,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -35,7 +35,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -60,11 +60,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### inline_comment -CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> ### name @@ -82,19 +82,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -112,14 +112,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +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. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Symbol ] } description=""/> +CodeFlag[ Symbol ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -360,7 +377,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -405,7 +422,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/SymbolGroup.mdx b/docs/api-reference/core/SymbolGroup.mdx index 5abfa0274..33681d192 100644 --- a/docs/api-reference/core/SymbolGroup.mdx +++ b/docs/api-reference/core/SymbolGroup.mdx @@ -13,7 +13,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -43,15 +43,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -65,15 +65,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -81,7 +81,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -90,22 +90,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ SymbolGroup ] } description=""/> +CodeFlag[ SymbolGroup ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -307,15 +307,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -323,7 +323,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/SymbolStatement.mdx b/docs/api-reference/core/SymbolStatement.mdx index 05ce0ff6b..24fcbce30 100644 --- a/docs/api-reference/core/SymbolStatement.mdx +++ b/docs/api-reference/core/SymbolStatement.mdx @@ -15,7 +15,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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls contained within the symbol associated with this statement." /> +list[ FunctionCall ] } description="Returns all function calls contained within the symbol associated with this statement." /> ### index @@ -53,11 +53,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ SymbolStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ SymbolStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -106,22 +106,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ SymbolStatement ] } description=""/> +CodeFlag[ SymbolStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +323,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -339,7 +339,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/TernaryExpression.mdx b/docs/api-reference/core/TernaryExpression.mdx index ea4354e53..78aa7c609 100644 --- a/docs/api-reference/core/TernaryExpression.mdx +++ b/docs/api-reference/core/TernaryExpression.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) @@ -20,17 +20,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### condition -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -70,19 +70,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -95,22 +95,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TernaryExpression ] } description=""/> +CodeFlag[ TernaryExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +312,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + Editable | None, optional } + type={ <>Editable | None, optional } description="The node to be edited. Defaults to None." defaultValue="None" /> @@ -343,7 +343,7 @@ 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/TryCatchStatement.mdx b/docs/api-reference/core/TryCatchStatement.mdx index 8524b3ce4..9f5fea452 100644 --- a/docs/api-reference/core/TryCatchStatement.mdx +++ b/docs/api-reference/core/TryCatchStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Expression](/api-reference/core/Expression), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable) @@ -29,11 +29,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -58,11 +58,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### finalizer -BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> +BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### index @@ -74,11 +74,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -92,19 +92,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -122,14 +122,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TryCatchStatement ] } description=""/> +CodeFlag[ TryCatchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +362,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -378,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -78,7 +78,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -87,22 +87,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -110,7 +110,7 @@ Edit the source for this Collection instance. ### find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Tuple ] } description=""/> +CodeFlag[ Tuple ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -195,7 +195,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -203,7 +203,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,15 +293,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -309,12 +309,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -326,7 +326,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/TupleType.mdx b/docs/api-reference/core/TupleType.mdx index 624cd0f2c..4f5ef7d63 100644 --- a/docs/api-reference/core/TupleType.mdx +++ b/docs/api-reference/core/TupleType.mdx @@ -13,7 +13,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), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -43,15 +43,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -65,19 +65,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -85,7 +85,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -94,22 +94,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -117,7 +117,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ TupleType ] } description=""/> +CodeFlag[ TupleType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -202,7 +202,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -210,7 +210,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,15 +300,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -316,12 +316,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -333,7 +333,7 @@ Removes an element from a Collection. ### replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/Type.mdx b/docs/api-reference/core/Type.mdx index 7c3b032ae..9eca5142a 100644 --- a/docs/api-reference/core/Type.mdx +++ b/docs/api-reference/core/Type.mdx @@ -13,7 +13,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) @@ -43,7 +43,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -57,19 +57,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -82,22 +82,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Type ] } description=""/> +CodeFlag[ Type ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +299,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -315,7 +315,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/TypeAlias.mdx b/docs/api-reference/core/TypeAlias.mdx index e4a999f53..2f28a0e4a 100644 --- a/docs/api-reference/core/TypeAlias.mdx +++ b/docs/api-reference/core/TypeAlias.mdx @@ -14,7 +14,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), [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) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attributes -list[ Attribute ] } description="List of expressions defined in this Type object." /> +list[ Attribute ] } description="List of expressions defined in this Type object." /> ### code_block @@ -32,19 +32,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -CommentGroup | None } description="Returns the comment group associated with the symbol, if any." /> +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." /> +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." /> +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." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -52,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -77,11 +77,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +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." /> +CommentGroup | None } description="Returns the inline comment group associated with the symbol, if any." /> ### is_decorated @@ -103,19 +103,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -133,23 +133,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +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. - + add_decorator Adds a decorator to a function or method. - + 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TypeAlias ] } description=""/> +CodeFlag[ TypeAlias ] } description=""/> ### get_attribute Get attribute by name. - + -Attribute | None } description=""/> +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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -421,7 +438,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -466,7 +483,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/TypePlaceholder.mdx b/docs/api-reference/core/TypePlaceholder.mdx index 43bf665ea..6755eb8b4 100644 --- a/docs/api-reference/core/TypePlaceholder.mdx +++ b/docs/api-reference/core/TypePlaceholder.mdx @@ -13,7 +13,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the type annotation of a placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/Typeable.mdx b/docs/api-reference/core/Typeable.mdx index 6a93fda67..73ad7dbbc 100644 --- a/docs/api-reference/core/Typeable.mdx +++ b/docs/api-reference/core/Typeable.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### is_typed @@ -63,15 +63,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -84,26 +84,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Typeable ] } description=""/> +CodeFlag[ Typeable ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +305,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/UnaryExpression.mdx b/docs/api-reference/core/UnaryExpression.mdx index bc3c6bafa..099985fa6 100644 --- a/docs/api-reference/core/UnaryExpression.mdx +++ b/docs/api-reference/core/UnaryExpression.mdx @@ -15,7 +15,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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### argument -Expression [ UnaryExpression ] } description="The argument of the unary expression" /> +Expression [ UnaryExpression ] } description="The argument of the unary expression" /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -63,19 +63,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -88,22 +88,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ UnaryExpression ] } description=""/> +CodeFlag[ UnaryExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +305,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Simplifies a unary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/UnionType.mdx b/docs/api-reference/core/UnionType.mdx index 9836f6060..ba17ec577 100644 --- a/docs/api-reference/core/UnionType.mdx +++ b/docs/api-reference/core/UnionType.mdx @@ -13,7 +13,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), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -43,15 +43,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -65,19 +65,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -85,7 +85,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -94,22 +94,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -117,7 +117,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ UnionType ] } description=""/> +CodeFlag[ UnionType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -202,7 +202,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -210,7 +210,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,15 +300,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -316,12 +316,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -333,7 +333,7 @@ Removes an element from a Collection. ### replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/core/Unpack.mdx b/docs/api-reference/core/Unpack.mdx index 3f794b4cd..42a6560ce 100644 --- a/docs/api-reference/core/Unpack.mdx +++ b/docs/api-reference/core/Unpack.mdx @@ -17,7 +17,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) @@ -47,7 +47,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -61,19 +61,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -86,26 +86,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Unpack ] } description=""/> +CodeFlag[ Unpack ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +307,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -323,7 +323,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -401,7 +401,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + None } description=""/> +### unwrap +Unwraps a node's content into its parent node. + + + +Expression | None } + description="The node to unwrap. If None, uses the instance's value node." + defaultValue="None" +/> + + + +None } description=""/> + + diff --git a/docs/api-reference/core/Unwrappable.mdx b/docs/api-reference/core/Unwrappable.mdx index 000306291..da6cfacf8 100644 --- a/docs/api-reference/core/Unwrappable.mdx +++ b/docs/api-reference/core/Unwrappable.mdx @@ -13,7 +13,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) @@ -43,7 +43,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -57,19 +57,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -82,22 +82,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Unwrappable ] } description=""/> +CodeFlag[ Unwrappable ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +299,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -315,7 +315,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> + + +### unwrap +Unwrap this expression, removing parenthesis and other syntax elements while maintaining the function of the code. + + + +None } description=""/> diff --git a/docs/api-reference/core/Usable.mdx b/docs/api-reference/core/Usable.mdx index cfd0e6e2a..a16806065 100644 --- a/docs/api-reference/core/Usable.mdx +++ b/docs/api-reference/core/Usable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -20,7 +20,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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Usable ] } description=""/> +CodeFlag[ Usable ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +317,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/Usage.mdx b/docs/api-reference/core/Usage.mdx index 8e91e6cb8..0a964ff7a 100644 --- a/docs/api-reference/core/Usage.mdx +++ b/docs/api-reference/core/Usage.mdx @@ -18,14 +18,14 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes ### imported_by -Import | None } description=" +Import | None } description=" " /> ### kind @@ -34,11 +34,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### match -Name | ChainedAttribute | FunctionCall } description="The exact match of the usage" /> +Name | ChainedAttribute | FunctionCall } description="The exact match of the usage" /> ### usage_symbol -Import | Symbol | Export | SourceFile } description="The symbol this object is used in" /> +Import | Symbol | Export | 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..55b1f80f7 100644 --- a/docs/api-reference/core/UsageKind.mdx +++ b/docs/api-reference/core/UsageKind.mdx @@ -25,7 +25,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/UsageType.mdx b/docs/api-reference/core/UsageType.mdx index 3bc3444ed..50cdd1e02 100644 --- a/docs/api-reference/core/UsageType.mdx +++ b/docs/api-reference/core/UsageType.mdx @@ -18,7 +18,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 2794e37a1..8a1792333 100644 --- a/docs/api-reference/core/Value.mdx +++ b/docs/api-reference/core/Value.mdx @@ -16,7 +16,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) @@ -46,7 +46,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -60,19 +60,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -85,22 +85,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ Value ] } description=""/> +CodeFlag[ Value ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +302,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -318,7 +318,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/core/WhileStatement.mdx b/docs/api-reference/core/WhileStatement.mdx index 249e14caf..62204c228 100644 --- a/docs/api-reference/core/WhileStatement.mdx +++ b/docs/api-reference/core/WhileStatement.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,15 +25,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> ### decorators -list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> +list[ Decorator ] } description="Returns list of all decorators on this Symbol." /> ### docstring -CommentGroup | None } description="Retrieves the docstring of the expression." /> +CommentGroup | None } description="Retrieves the docstring of the expression." /> ### extended @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the while statement block." /> +list[ FunctionCall ] } description="Returns all function calls within the while statement block." /> ### index @@ -70,11 +70,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ WhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ WhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -88,19 +88,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -118,14 +118,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ WhileStatement ] } description=""/> +CodeFlag[ WhileStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +358,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -374,7 +374,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [Statement](/api-reference/core/Statement), [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,15 +41,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -PyCodeBlock [ WithStatement ] } description="(PyCodeBlock) the code block of the with statement" /> +PyCodeBlock [ WithStatement ] } description="(PyCodeBlock) the code block of the with statement" /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -74,7 +74,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls in the code block and within the with clause." /> +list[ FunctionCall ] } description="Returns all function calls in the code block and within the with clause." /> ### index @@ -86,11 +86,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ PyCodeBlock ] } description="Returns all nested code blocks within the statement." /> +list[ PyCodeBlock ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ WithStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ WithStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -104,19 +104,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -134,14 +134,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ WithStatement ] } description=""/> +CodeFlag[ WithStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +374,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -390,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### 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) @@ -23,11 +23,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -PyCommentGroup | None } description="Returns the comment group associated with the symbol." /> +PyCommentGroup | None } description="Returns 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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -35,7 +35,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -60,7 +60,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -68,7 +68,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -PyCommentGroup | None } description="A property that retrieves the inline comment group associated with a symbol." /> +PyCommentGroup | None } description="A property that retrieves the inline comment group associated with a symbol." /> ### is_exported @@ -98,19 +98,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -128,22 +128,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyAssignment ] } description=""/> +CodeFlag[ PyAssignment ] } description=""/> ### from_named_expression Creates a MultiExpression from a Python named expression. - + -MultiExpression [ PyAssignmentStatement , PyAssignment ] } description="A MultiExpression containing the assignments created from the named expression."/> +MultiExpression [ PyAssignmentStatement , PyAssignment ] } description="A MultiExpression containing the assignments created from the named expression."/> ### get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -472,15 +489,15 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + -list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> +list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment for the Python symbol. - + PyCommentType , optional } + type={ <>PyCommentType , optional } description="Type of comment to add (e.g., single line," defaultValue="PyCommentType.SINGLE_LINE" /> @@ -668,7 +708,7 @@ Sets a comment for the Python symbol. ### set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyAssignmentStatement.mdx b/docs/api-reference/python/PyAssignmentStatement.mdx index dcfe6b072..0cc7c7d8b 100644 --- a/docs/api-reference/python/PyAssignmentStatement.mdx +++ b/docs/api-reference/python/PyAssignmentStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -30,7 +30,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -64,16 +64,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -87,23 +87,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -122,26 +122,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyAssignmentStatement ] } description=""/> +CodeFlag[ PyAssignmentStatement ] } description=""/> ### 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +396,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -412,7 +412,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [PyAssignmentStatement](/api-reference/python/PyAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -30,12 +30,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -64,7 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -80,7 +80,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### name @@ -89,11 +89,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -107,23 +107,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -142,26 +142,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyAttribute ] } description=""/> +CodeFlag[ PyAttribute ] } description=""/> ### from_assignment Creates a PyAssignmentStatement instance from a TreeSitter assignment node. - + 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,23 +424,23 @@ 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."/> +list[ Editable [ PyAttribute ]] } description="A sorted list of unique attribute references. Each reference is an Editable object representing a usage of this attribute."/> ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -448,7 +448,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyBlockStatement.mdx b/docs/api-reference/python/PyBlockStatement.mdx index 458a4064b..1120659de 100644 --- a/docs/api-reference/python/PyBlockStatement.mdx +++ b/docs/api-reference/python/PyBlockStatement.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 [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,16 +20,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -66,11 +66,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -84,19 +84,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -114,14 +114,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyBlockStatement ] } description=""/> +CodeFlag[ PyBlockStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +354,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -370,7 +370,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -49,11 +49,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyBreakStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyBreakStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -97,22 +97,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyBreakStatement ] } description=""/> +CodeFlag[ PyBreakStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyCatchStatement.mdx b/docs/api-reference/python/PyCatchStatement.mdx index 748755607..1e5ca1cd6 100644 --- a/docs/api-reference/python/PyCatchStatement.mdx +++ b/docs/api-reference/python/PyCatchStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,20 +25,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> +Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -63,7 +63,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -75,11 +75,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -93,19 +93,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -123,14 +123,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyCatchStatement ] } description=""/> +CodeFlag[ PyCatchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +363,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -379,7 +379,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -51,7 +51,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -69,19 +69,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -94,22 +94,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyChainedAttribute ] } description=""/> +CodeFlag[ PyChainedAttribute ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +311,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -327,7 +327,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyClass.mdx b/docs/api-reference/python/PyClass.mdx index d2c26a5a4..318cb694a 100644 --- a/docs/api-reference/python/PyClass.mdx +++ b/docs/api-reference/python/PyClass.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 [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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -28,11 +28,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> +PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> ### constructor -Function | None } description="Returns the constructor method for this class." /> +Function | None } description="Returns the constructor method for this class." /> ### constructor_keyword @@ -41,15 +41,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -82,11 +82,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### inline_comment -PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> +PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> ### is_decorated @@ -106,7 +106,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_classes -list[ PyClass ] } description="Retrieves the nested classes defined within this class." /> +list[ PyClass ] } description="Retrieves the nested classes defined within this class." /> ### node_type @@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , PyClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , PyClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -124,32 +124,32 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | 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 | ChainedAttribute ] } 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=" " /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -168,19 +168,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds an attribute to a class from raw source code, placing it in a specific location - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### 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[ 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."/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyClass ] } description=""/> +CodeFlag[ PyClass ] } description=""/> ### 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."/> +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."/> ### get_import_string Generates an import string for a Python symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + -Function | None } description="The method if found, None otherwise."/> +Function | None } description="The method if found, None otherwise."/> ### 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."/> +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_nested_class Returns a nested class by name from the current class. - + -PyClass | None } description="The nested class if found, None otherwise."/> +PyClass | None } description="The nested class if found, None otherwise."/> ### 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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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. - + -Editable | None } description="The matching parent class node, or None if no match is found."/> +Editable | None } description="The matching parent class node, or None if no match is found."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 | Class } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" /> @@ -711,7 +728,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=""/> @@ -719,7 +736,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[ Function ] | MultiLineCollection [ Function , PyClass ] } description=""/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -793,7 +810,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment for the Python symbol. - + PyCommentType , optional } + type={ <>PyCommentType , optional } description="Type of comment to add (e.g., single line," defaultValue="PyCommentType.SINGLE_LINE" /> @@ -927,7 +967,7 @@ Sets a comment for the Python symbol. ### set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + -list[ Class ] } description="A list of Class objects that inherit from this class."/> +list[ Class ] } 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[ 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."/> ### symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyCodeBlock.mdx b/docs/api-reference/python/PyCodeBlock.mdx index 88765aa14..6beedab26 100644 --- a/docs/api-reference/python/PyCodeBlock.mdx +++ b/docs/api-reference/python/PyCodeBlock.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 [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[ AssignmentStatement [ PyCodeBlock , Assignment ]] } 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[ Assignment [ 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[ Attribute [ 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[ Comment [ Editable , PyCodeBlock ]] } description="Gets list of top level comments in the code block." /> ### extended @@ -57,11 +57,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> +list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> ### if_blocks -list[ IfBlockStatement [ PyCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> +list[ IfBlockStatement [ PyCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> ### level @@ -70,7 +70,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### local_var_assignments -list[ Assignment [ Editable , PyCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> +list[ Assignment [ Editable , PyCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> ### node_type @@ -84,28 +84,28 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement [ PyCodeBlock ]] } description="Gets all return statements at the top level of the code block." /> +list[ ReturnStatement [ PyCodeBlock ]] } description="Gets all return statements at the top level of the code block." /> ### source @@ -113,11 +113,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### statements -MultiLineCollection [ Statement , PyCodeBlock ] } description="Gets a view of the top-level statements in the code block." /> +MultiLineCollection [ Statement , PyCodeBlock ] } description="Gets a view of the top-level statements in the code block." /> ### symbol_statements -list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> +list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> ### ts_node @@ -126,26 +126,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ### with_statements -list[ WithStatement ] } description="Returns a list of all 'with' statements within the code block." /> +list[ WithStatement ] } description="Returns a list of all 'with' statements within the code block." /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyCodeBlock ] } description=""/> +CodeFlag[ PyCodeBlock ] } description=""/> ### 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[ Assignment [ 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[ Attribute [ 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."/> +Comment [ 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."/> +Assignment [ 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[ Assignment [ 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. - + StatementType | None } + type={ <>StatementType | None } description="The type of statements to return. If None, returns all statement types." defaultValue="None" /> @@ -343,12 +343,12 @@ Returns all statements of a given type up to the specified block level. -list[ Statement [ PyCodeBlock ]] } description=""/> +list[ Statement [ PyCodeBlock ]] } description=""/> ### get_variable_usages Returns all instances of variable usages in a code block. - + -list[ Editable [ PyCodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> +list[ Editable [ PyCodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> ### get_with_statements Gets with statements at a specific block level. - + -list[ WithStatement ] } description="A list of WithStatement objects at the specified block level."/> +list[ WithStatement ] } description="A list of WithStatement objects at the specified block level."/> ### indent Adjusts the indentation level of the entire code block. - + None } description=""/> +### insert_after +Inserts source code at the bottom of the code block. + + + +str } + description="The source code to insert." + defaultValue="" +/> +bool } + description="Whether to fix the indentation of the inserted code. Defaults to True." + defaultValue="True" +/> +bool } + description="Whether to add a newline before the inserted code. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + ### 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=""/> @@ -430,15 +459,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -446,7 +475,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### unwrap Extracts a code block from its parent wrapper container by removing the wrapping - + None } description=""/> @@ -582,7 +611,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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### google_style @@ -57,11 +57,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyComment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -75,19 +75,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -109,22 +109,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### clean_comment Cleans a comment block by removing comment symbols, leading/trailing whitespace, and standardizing indentation. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyComment ] } description=""/> +CodeFlag[ PyComment ] } description=""/> ### 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +395,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -411,7 +411,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyCommentGroup.mdx b/docs/api-reference/python/PyCommentGroup.mdx index d7a5fbca8..36a9c5bbf 100644 --- a/docs/api-reference/python/PyCommentGroup.mdx +++ b/docs/api-reference/python/PyCommentGroup.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [CommentGroup](/api-reference/core/CommentGroup), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -50,15 +50,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -72,15 +72,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -88,7 +88,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### text @@ -101,22 +101,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ PyCommentGroup ] } description=""/> +CodeFlag[ PyCommentGroup ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,15 +335,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -351,7 +351,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> ### to_google_docstring Convert a comment group into a Google-style docstring. - + + ## Attributes diff --git a/docs/api-reference/python/PyConditionalExpression.mdx b/docs/api-reference/python/PyConditionalExpression.mdx index 18f394eaf..6861ab3b0 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,17 +20,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### condition -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -70,19 +70,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -95,22 +95,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyConditionalExpression ] } description=""/> +CodeFlag[ PyConditionalExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +312,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + Editable | None, optional } + type={ <>Editable | None, optional } description="The node to be edited. Defaults to None." defaultValue="None" /> @@ -343,7 +343,7 @@ 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyDecorator.mdx b/docs/api-reference/python/PyDecorator.mdx index 9bbf945c4..a4599d5ce 100644 --- a/docs/api-reference/python/PyDecorator.mdx +++ b/docs/api-reference/python/PyDecorator.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 [Decorator](/api-reference/core/Decorator), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call -FunctionCall | None } description="Gets the function call node from the decorator if the decorator is a call." /> +FunctionCall | None } description="Gets the function call node from the decorator if the decorator is a call." /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyDecorator ] } description=""/> +CodeFlag[ PyDecorator ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +317,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [SourceFile](/api-reference/core/SourceFile), [HasBlock](/api-reference/core/HasBlock), [Usable](/api-reference/core/Usable), [File](/api-reference/core/File), [Expression](/api-reference/core/Expression), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ Class ] } description="Returns all Classes in the file." /> +list[ Class ] } description="Returns all Classes in the file." /> ### code_block @@ -33,19 +33,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### directory -Directory | None } description="Returns the directory that contains this file." /> +Directory | None } description="Returns the directory that contains this file." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -83,15 +83,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### functions -list[ Function ] } description="Returns all Functions in the file." /> +list[ Function ] } description="Returns all Functions in the file." /> ### global_vars -list[ Assignment ] } description="Returns all GlobalVars in the file." /> +list[ Assignment ] } description="Returns all GlobalVars in the file." /> ### import_module_name @@ -99,19 +99,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[ ImportStatement ] } 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[ Import ] } description="Returns all imports that directly imports this file as a module." /> ### imports -list[ Import ] } description="List of all Imports in this file." /> +list[ Import ] } 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[ Import ] } description="Returns all imports that are importing symbols contained in this file." /> ### is_binary @@ -141,15 +141,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### path @@ -163,7 +163,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -175,7 +175,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" /> +list[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> ### ts_node @@ -184,14 +184,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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. - + None } description="This function modifies the file in place."/> +### add_symbol +Adds `symbol` to the file. + + + +Symbol } + description="The symbol to add to the file." + defaultValue="" +/> +bool, optional } + description="Whether to export the symbol. Defaults to True." + defaultValue="True" +/> + + + +Symbol | 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. - + None } description="The symbol is added directly to the file's content."/> +### add_symbol_import +Adds an import to a file for a given symbol. + + + +Symbol } + description="The symbol to import." + defaultValue="" +/> +str | None } + description="Optional alias for the imported symbol. Defaults to None." + defaultValue="None" +/> +ImportType } + description="The type of import to use. Defaults to ImportType.UNKNOWN." + defaultValue="ImportType.UNKNOWN" +/> +bool } + description="Whether this is a type-only import. Defaults to False." + defaultValue="False" +/> + + + +Import | 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +list[ Editable ] } description="A list of Editable instances that match the search criteria."/> ### find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + -list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> +list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> ### find_string_literals Returns a list of string literals within this node's source that match any of the given - + -list[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyFile ] } description=""/> +CodeFlag[ PyFile ] } description=""/> ### 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."/> +Class | 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."/> @@ -387,7 +445,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."/> +Function | 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."/> +Assignment | 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."/> +Import | 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. + + + +str } + description="The import statement to be inserted." + defaultValue="" +/> + + + +int | None } description="The index where the import should be inserted. Returns 0 for future imports or if there are no existing imports after future imports. Returns None if there are no imports in the file."/> ### get_import_string Generates an import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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_symbol Gets a symbol by its name from the file. - + -Symbol | None } description="The found symbol, or None if not found."/> +Symbol | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -628,15 +703,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -644,15 +719,38 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if a Python symbol can be added to this Python source file. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### 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 | 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"/> ### 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. - + UsageType | None } + type={ <>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."/> +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/python/PyForLoopStatement.mdx b/docs/api-reference/python/PyForLoopStatement.mdx index 3ba9d40db..32f82d0fc 100644 --- a/docs/api-reference/python/PyForLoopStatement.mdx +++ b/docs/api-reference/python/PyForLoopStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [ForLoopStatement](/api-reference/core/ForLoopStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,16 +25,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within this for loop statement." /> +list[ FunctionCall ] } description="Gets all function calls within this for loop statement." /> ### index @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### item -Expression [ PyForLoopStatement ] } description="An item in the iterable object" /> +Expression [ PyForLoopStatement ] } description="An item in the iterable object" /> ### iterable -Expression [ PyForLoopStatement ] } description="The iterable that is being iterated over" /> +Expression [ PyForLoopStatement ] } description="The iterable that is being iterated over" /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -97,19 +97,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -127,14 +127,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyForLoopStatement ] } description=""/> +CodeFlag[ PyForLoopStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +367,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -383,7 +383,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [PySymbol](/api-reference/python/PySymbol), [Function](/api-reference/core/Function), [HasBlock](/api-reference/core/HasBlock), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -32,19 +32,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> +PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -52,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -77,7 +77,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> +list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> ### function_signature @@ -89,7 +89,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> +PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> ### is_async @@ -141,7 +141,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_functions -list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> +list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> ### node_type @@ -150,7 +150,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , PyFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , PyFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -159,27 +159,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> +list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### source @@ -198,19 +198,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### asyncify Modifies the function to be asynchronous. - + None } description=""/> @@ -301,7 +318,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyFunction ] } description=""/> +CodeFlag[ PyFunction ] } description=""/> ### get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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_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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + None } description=""/> +### insert_statements +Inserts lines of code into the function body at the specified index. + + + +str } + description="The code lines to insert into the function body." + defaultValue="" +/> +int, optional } + description="The position in the function body where the lines should be inserted. Defaults to 0." + defaultValue="0" +/> + + + +None } description=""/> + + ### is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -603,7 +643,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=""/> +Editable | None } description=""/> ### prepend_statements Prepends statements to the start of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -665,7 +705,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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."/> + + ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment for the Python symbol. - + PyCommentType , optional } + type={ <>PyCommentType , optional } description="Type of comment to add (e.g., single line," defaultValue="PyCommentType.SINGLE_LINE" /> @@ -828,7 +891,7 @@ Sets a comment for the Python symbol. ### set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets or modifies the return type annotation of a function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyGenericType.mdx b/docs/api-reference/python/PyGenericType.mdx index dc9f80239..c5273ddcf 100644 --- a/docs/api-reference/python/PyGenericType.mdx +++ b/docs/api-reference/python/PyGenericType.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PyNamedType](/api-reference/python/PyNamedType), [GenericType](/api-reference/core/GenericType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -62,7 +62,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -Collection[ Type , PyGenericType ] } description="Retrieves the generic type parameters associated with this type." /> +Collection[ Type , PyGenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyGenericType ] } description=""/> +CodeFlag[ PyGenericType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +321,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,11 +24,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### is_decorated @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,14 +96,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyHasBlock ] } description=""/> +CodeFlag[ PyHasBlock ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +336,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -29,11 +29,11 @@ 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[ IfBlockStatement ] } 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 [ PyIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> ### consequence_block @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### else_statement -IfBlockStatement | None } description="Returns the else block within the if-statement." /> +IfBlockStatement | None } description="Returns the else block within the if-statement." /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> +list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> ### index @@ -86,11 +86,11 @@ 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[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyIfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -104,19 +104,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -134,22 +134,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### 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[ IfBlockStatement ] } 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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyIfBlockStatement ] } description=""/> +CodeFlag[ PyIfBlockStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +359,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyImport.mdx b/docs/api-reference/python/PyImport.mdx index 14708bbeb..015641375 100644 --- a/docs/api-reference/python/PyImport.mdx +++ b/docs/api-reference/python/PyImport.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 [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,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" +Editable | None } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### from_file -SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> +SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> ### full_name @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### import_specifier @@ -75,15 +75,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imported_exports -list[ Exportable ] } description="Returns a list of exports from an import statement." /> +list[ Exportable ] } description="Returns a list of exports from an import statement." /> ### imported_symbol -Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> ### module -Editable | None } description=" +Editable | None } description=" " /> ### name @@ -106,23 +106,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_symbol -Symbol | ExternalModule | SourceFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> +Symbol | ExternalModule | SourceFile | None } description="Returns the symbol, source file, or external module that this import ultimately resolves" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -130,7 +130,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_name -Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> +Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> ### to_file @@ -148,22 +148,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyImport ] } description=""/> +CodeFlag[ PyImport ] } description=""/> ### get_import_string Generates an import string for a Python import statement. - + 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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."/> @@ -408,7 +408,7 @@ Returns True if this import is aliased. ### is_module_import Determines if the import is a module-level or wildcard import. - + bool } description="True if the import is a module-level or wildcard import, False otherwise."/> @@ -416,7 +416,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 +424,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 +432,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 +440,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,15 +448,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -464,7 +464,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyImportStatement.mdx b/docs/api-reference/python/PyImportStatement.mdx index 3476f98a8..7a9990b48 100644 --- a/docs/api-reference/python/PyImportStatement.mdx +++ b/docs/api-reference/python/PyImportStatement.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 [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,11 +41,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -53,11 +53,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -101,22 +101,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyImportStatement ] } description=""/> +CodeFlag[ PyImportStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +318,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -334,7 +334,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyMatchCase.mdx b/docs/api-reference/python/PyMatchCase.mdx index c0e122671..c7f094d91 100644 --- a/docs/api-reference/python/PyMatchCase.mdx +++ b/docs/api-reference/python/PyMatchCase.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 [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,20 +20,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> +Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### extended @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -70,11 +70,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyMatchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -88,19 +88,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -118,14 +118,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyMatchCase ] } description=""/> +CodeFlag[ PyMatchCase ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +358,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -374,7 +374,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### cases -list[ SwitchCase ] } description=" +list[ SwitchCase ] } description=" " /> ### extended @@ -46,7 +46,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> +list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> ### index @@ -54,11 +54,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ PyMatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -72,19 +72,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -102,26 +102,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ PyMatchStatement ] } description="The value to switch on" /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyMatchStatement ] } description=""/> +CodeFlag[ PyMatchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +323,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -339,7 +339,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyNamedType.mdx b/docs/api-reference/python/PyNamedType.mdx index 379196912..cb5f2b4be 100644 --- a/docs/api-reference/python/PyNamedType.mdx +++ b/docs/api-reference/python/PyNamedType.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -68,19 +68,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -93,22 +93,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyNamedType ] } description=""/> +CodeFlag[ PyNamedType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +318,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -334,7 +334,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from -[Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Typeable](/api-reference/core/Typeable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) +[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) ## Attributes @@ -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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -87,19 +87,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -112,22 +112,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyParameter ] } description=""/> +CodeFlag[ PyParameter ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +362,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -378,7 +378,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation of a parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyPassStatement.mdx b/docs/api-reference/python/PyPassStatement.mdx index c70ec5e8d..ef6158ec3 100644 --- a/docs/api-reference/python/PyPassStatement.mdx +++ b/docs/api-reference/python/PyPassStatement.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 [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -49,11 +49,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyPassStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyPassStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -97,22 +97,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyPassStatement ] } description=""/> +CodeFlag[ PyPassStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PyReturnTypePlaceholder.mdx b/docs/api-reference/python/PyReturnTypePlaceholder.mdx index 8e7618e58..ddea4ae87 100644 --- a/docs/api-reference/python/PyReturnTypePlaceholder.mdx +++ b/docs/api-reference/python/PyReturnTypePlaceholder.mdx @@ -13,7 +13,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits or creates a return type annotation for a method or function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/python/PyString.mdx b/docs/api-reference/python/PyString.mdx index 80a1e072b..156426352 100644 --- a/docs/api-reference/python/PyString.mdx +++ b/docs/api-reference/python/PyString.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,12 +24,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" +Collection[ Expression [ Editable ], PyString ] } description=" " /> ### 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 @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -68,19 +68,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -93,7 +93,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ### with_quotes @@ -104,15 +104,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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyString ] } description=""/> +CodeFlag[ PyString ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/python/PySymbol.mdx b/docs/api-reference/python/PySymbol.mdx index d7f8c384f..4207723b1 100644 --- a/docs/api-reference/python/PySymbol.mdx +++ b/docs/api-reference/python/PySymbol.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 [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) @@ -20,11 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> +PyCommentGroup | None } description="Retrieves the comment group associated with a Python symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -32,7 +32,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> +list[ Editable ] } description="Returns a list of Editable nodes associated with this symbol, including extended symbols." /> ### extended_source @@ -57,11 +57,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### inline_comment -PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> +PyCommentGroup | None } description="Returns the inline comment group associated with this symbol." /> ### is_exported @@ -83,19 +83,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -113,14 +113,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PySymbol ] } description=""/> +CodeFlag[ PySymbol ] } description=""/> ### get_import_string Generates an import string for a Python symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -414,7 +431,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -459,7 +476,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment for the Python symbol. - + PyCommentType , optional } + type={ <>PyCommentType , optional } description="Type of comment to add (e.g., single line," defaultValue="PyCommentType.SINGLE_LINE" /> @@ -593,7 +633,7 @@ Sets a comment for the Python symbol. ### set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/python/PyTryCatchStatement.mdx b/docs/api-reference/python/PyTryCatchStatement.mdx index e1c0aeda4..2988fae0f 100644 --- a/docs/api-reference/python/PyTryCatchStatement.mdx +++ b/docs/api-reference/python/PyTryCatchStatement.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,20 +24,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### except_clauses -list[ PyCatchStatement [ PyTryCatchStatement ]] } description="The exception handlers." /> +list[ PyCatchStatement [ PyTryCatchStatement ]] } description="The exception handlers." /> ### extended @@ -62,11 +62,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### finalizer -BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> +BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> ### function_calls -list[ FunctionCall ] } description="Gets a list of all function calls contained within the try-catch statement." /> +list[ FunctionCall ] } description="Gets a list of all function calls contained within the try-catch statement." /> ### index @@ -78,11 +78,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ PyCodeBlock ] } description="Returns all CodeBlocks nested within this try-catch statement." /> +list[ PyCodeBlock ] } description="Returns all CodeBlocks nested within this try-catch statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -96,19 +96,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -126,14 +126,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyTryCatchStatement ] } description=""/> +CodeFlag[ PyTryCatchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +366,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -382,7 +382,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [UnionType](/api-reference/core/UnionType), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -45,15 +45,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -119,7 +119,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ PyUnionType ] } description=""/> +CodeFlag[ PyUnionType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -204,7 +204,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -212,7 +212,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,15 +302,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -318,12 +318,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -335,7 +335,7 @@ Removes an element from a Collection. ### replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/python/PyWhileStatement.mdx b/docs/api-reference/python/PyWhileStatement.mdx index 344cc6965..f78a97cc4 100644 --- a/docs/api-reference/python/PyWhileStatement.mdx +++ b/docs/api-reference/python/PyWhileStatement.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -29,19 +29,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> ### decorators -list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ PyDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -PyCommentGroup | None } description="Gets the function's docstring." /> +PyCommentGroup | None } description="Gets the function's docstring." /> ### else_statement -PyIfBlockStatement [ PyCodeBlock [ PyWhileStatement ]] | None } description="the statement that will run if the while loop completes, if any." /> +PyIfBlockStatement [ PyCodeBlock [ PyWhileStatement ]] | None } description="the statement that will run if the while loop completes, if any." /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the while statement and its else block." /> +list[ FunctionCall ] } description="Returns all function calls within the while statement and its else block." /> ### index @@ -78,11 +78,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ PyCodeBlock ] } description="Returns a list of all code blocks nested within the while statement." /> +list[ PyCodeBlock ] } description="Returns a list of all code blocks nested within the while statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ PyWhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ PyWhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -96,19 +96,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -126,14 +126,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ PyWhileStatement ] } description=""/> +CodeFlag[ PyWhileStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +366,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -382,7 +382,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -20,11 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attributes -list[ JSXProp ] } description="Returns all JSXProp on this JSXElement, an alias for JSXElement.props." /> +list[ JSXProp ] } description="Returns all JSXProp on this JSXElement, an alias for JSXElement.props." /> ### expressions -list[ JSXExpression ] } description="Gets all JSX expressions within the JSX element." /> +list[ JSXExpression ] } description="Gets all JSX expressions within the JSX element." /> ### extended @@ -53,11 +53,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### jsx_elements -list[ JSXElement ] } description="Returns a list of JSX elements nested within the current element." /> +list[ JSXElement ] } description="Returns a list of JSX elements nested within the current element." /> ### name @@ -75,23 +75,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### props -list[ JSXProp ] } description="Retrieves all JSXProps (attributes) from a JSX element." /> +list[ JSXProp ] } description="Retrieves all JSXProps (attributes) from a JSX element." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -104,14 +104,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ JSXElement ] } description=""/> +CodeFlag[ JSXElement ] } 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."/> +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_prop Returns the JSXProp with the given name from the JSXElement. - + -JSXProp | None } description="The matching JSXProp object if found, None if not found."/> +JSXProp | None } description="The matching JSXProp object if found, None if not found."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +369,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -385,7 +385,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### statement -Editable [ JSXExpression ] | None } description="Returns the editable component of this JSX expression." /> +Editable [ JSXExpression ] | None } description="Returns the editable component of this JSX expression." /> ### ts_node @@ -84,22 +84,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ JSXExpression ] } description=""/> +CodeFlag[ JSXExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +301,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> + + +### 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 36a16000d..800187bdf 100644 --- a/docs/api-reference/typescript/JSXProp.mdx +++ b/docs/api-reference/typescript/JSXProp.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### expression -JSXExpression | None } description="Retrieves the JSX expression associated with this JSX prop." /> +JSXExpression | None } description="Retrieves the JSX expression associated with this JSX prop." /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,26 +92,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ JSXProp ] } description=""/> +CodeFlag[ JSXProp ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after a JSX prop in a TypeScript/JSX file. - + insert_before Insert a new source code string before a JSX prop in a React component. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,15 +321,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSNamedType](/api-reference/typescript/TSNamedType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -48,7 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -66,19 +66,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -91,22 +91,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSArrayType ] } description=""/> +CodeFlag[ TSArrayType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +316,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -332,7 +332,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [TSSymbol](/api-reference/typescript/TSSymbol), [Assignment](/api-reference/core/Assignment), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -32,15 +32,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -52,7 +52,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -77,7 +77,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### has_semicolon @@ -89,7 +89,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_exported @@ -123,23 +123,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -157,22 +157,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSAssignment ] } description=""/> +CodeFlag[ TSAssignment ] } description=""/> ### from_named_expression Creates a MultiExpression object from a TypeScript named expression node. - + -MultiExpression [ TSAssignmentStatement , TSAssignment ] } description="A MultiExpression object containing the constructed assignments."/> +MultiExpression [ TSAssignmentStatement , TSAssignment ] } description="A MultiExpression object containing the constructed assignments."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -501,15 +518,15 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + -list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> +list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -697,7 +737,7 @@ Sets a comment to the symbol. ### set_inline_comment Sets an inline comment for an assignment node. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSAssignmentStatement.mdx b/docs/api-reference/typescript/TSAssignmentStatement.mdx index f9519cb42..894ae1977 100644 --- a/docs/api-reference/typescript/TSAssignmentStatement.mdx +++ b/docs/api-reference/typescript/TSAssignmentStatement.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -30,7 +30,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -64,16 +64,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TSAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TSAssignmentStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -87,23 +87,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -122,26 +122,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSAssignmentStatement ] } description=""/> +CodeFlag[ TSAssignmentStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +343,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -359,7 +359,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSAssignmentStatement](/api-reference/typescript/TSAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -30,12 +30,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### assignments -list[ Assignment ] } description=" +list[ Assignment ] } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -64,7 +64,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -80,7 +80,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### left -Expression [ Assignment ] } description=" +Expression [ Assignment ] } description=" " /> ### name @@ -89,11 +89,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TSAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TSAttribute ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -107,23 +107,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -Expression [ Assignment ] | None } description=" +Expression [ Assignment ] | None } description=" " /> ### source @@ -142,26 +142,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSAttribute ] } description=""/> +CodeFlag[ TSAttribute ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -371,7 +371,7 @@ Check if this node is contained another node of the given class ### local_usages Returns local usages of a TypeScript attribute within its code block. - + -list[ Editable ] } description="A sorted list of unique Editable instances representing local usages of the attribute, ordered by their position in the source code."/> +list[ Editable ] } description="A sorted list of unique Editable instances representing local usages of the attribute, ordered by their position in the source code."/> ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -404,7 +404,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSBlockStatement.mdx b/docs/api-reference/typescript/TSBlockStatement.mdx index b59c4d5d8..e5cb152ba 100644 --- a/docs/api-reference/typescript/TSBlockStatement.mdx +++ b/docs/api-reference/typescript/TSBlockStatement.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 [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,16 +20,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -66,15 +66,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSBlockStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSBlockStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -88,19 +88,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -118,14 +118,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSBlockStatement ] } description=""/> +CodeFlag[ TSBlockStatement ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSBlockStatement ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSBlockStatement ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +375,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -391,7 +391,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -25,20 +25,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> +Expression [ PyCatchStatement ] | None } description="The condition which triggers this clause" /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -63,7 +63,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -75,15 +75,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSCatchStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSCatchStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -97,19 +97,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -127,14 +127,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSCatchStatement ] } description=""/> +CodeFlag[ TSCatchStatement ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSCatchStatement ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSCatchStatement ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +384,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -400,7 +400,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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) @@ -54,7 +54,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of function calls associated with this chained attribute's object." /> +list[ FunctionCall ] } description="Returns a list of function calls associated with this chained attribute's object." /> ### node_type @@ -72,19 +72,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -97,22 +97,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSChainedAttribute ] } description=""/> +CodeFlag[ TSChainedAttribute ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSClass.mdx b/docs/api-reference/typescript/TSClass.mdx index dd11a2c8a..21f31889e 100644 --- a/docs/api-reference/typescript/TSClass.mdx +++ b/docs/api-reference/typescript/TSClass.mdx @@ -21,7 +21,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -30,7 +30,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -38,11 +38,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### constructor -Function | None } description="Returns the constructor method for this class." /> +Function | None } description="Returns the constructor method for this class." /> ### constructor_keyword @@ -50,19 +50,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -74,7 +74,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### has_semicolon @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_decorated @@ -131,7 +131,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSClass ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSClass ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -139,7 +139,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_classes -list[ TSClass ] } description="Retrieves the nested classes defined within this class." /> +list[ TSClass ] } description="Retrieves the nested classes defined within this class." /> ### node_type @@ -148,7 +148,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , TSClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , TSClass ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -157,37 +157,37 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | 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 | ChainedAttribute ] } 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=" " /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -205,19 +205,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds a class attribute from source code to a TypeScript/JavaScript class. - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### 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[ 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."/> ### class_component_to_function_component Converts a class component to a function component. - + None } description=""/> @@ -371,7 +388,7 @@ Converts a class component to a function component. ### convert_props_to_interface Converts React component props to TypeScript interfaces. - + None } description=""/> @@ -379,7 +396,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSClass ] } description=""/> +CodeFlag[ TSClass ] } description=""/> ### 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."/> +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."/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSClass ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSClass ] | None } description="The matching JSX element if found, None otherwise."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + -Function | None } description="The method if found, None otherwise."/> +Function | None } description="The method if found, None otherwise."/> ### 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."/> +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_nested_class Returns a nested class by name from the current class. - + -TSClass | None } description="The nested class if found, None otherwise."/> +TSClass | None } description="The nested class if found, None otherwise."/> ### 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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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. - + -Editable | None } description="The matching parent class node, or None if no match is found."/> +Editable | None } description="The matching parent class node, or None if no match is found."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 | Class } description="The parent class to check for. Can be specified either as a class name string or Class object." defaultValue="" /> @@ -781,7 +798,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=""/> @@ -789,7 +806,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[ Function ] | MultiLineCollection [ Function , TSClass ] } description=""/> ### 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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -863,7 +880,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -997,7 +1037,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + -list[ Class ] } description="A list of Class objects that inherit from this class."/> +list[ Class ] } 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[ 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."/> ### symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSCodeBlock.mdx b/docs/api-reference/typescript/TSCodeBlock.mdx index 96621d023..d9a5705fa 100644 --- a/docs/api-reference/typescript/TSCodeBlock.mdx +++ b/docs/api-reference/typescript/TSCodeBlock.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 [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[ AssignmentStatement [ TSCodeBlock , Assignment ]] } 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[ Assignment [ 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[ Attribute [ 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[ Comment [ Editable , TSCodeBlock ]] } description="Gets list of top level comments in the code block." /> ### extended @@ -57,11 +57,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> +list[ FunctionCall ] } description="Returns a list of all function calls in the code block." /> ### if_blocks -list[ IfBlockStatement [ TSCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> +list[ IfBlockStatement [ TSCodeBlock ]] } description="Returns a list of top level if statements in the code block." /> ### level @@ -70,7 +70,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### local_var_assignments -list[ Assignment [ Editable , TSCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> +list[ Assignment [ Editable , TSCodeBlock ]] } description="Returns all local variable assignment in the code block, for all nest levels." /> ### node_type @@ -84,28 +84,28 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement [ TSCodeBlock ]] } description="Gets all return statements at the top level of the code block." /> +list[ ReturnStatement [ TSCodeBlock ]] } description="Gets all return statements at the top level of the code block." /> ### source @@ -113,11 +113,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### statements -MultiLineCollection [ Statement , TSCodeBlock ] } description="Gets a view of the top-level statements in the code block." /> +MultiLineCollection [ Statement , TSCodeBlock ] } description="Gets a view of the top-level statements in the code block." /> ### symbol_statements -list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> +list[ SymbolStatement ] } description="Returns list of top level symbol statements in the code block." /> ### ts_node @@ -126,22 +126,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSCodeBlock ] } description=""/> +CodeFlag[ TSCodeBlock ] } description=""/> ### 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[ Assignment [ 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[ Attribute [ 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."/> +Comment [ 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."/> +Assignment [ 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[ Assignment [ 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. - + StatementType | None } + type={ <>StatementType | None } description="The type of statements to return. If None, returns all statement types." defaultValue="None" /> @@ -339,12 +339,12 @@ Returns all statements of a given type up to the specified block level. -list[ Statement [ TSCodeBlock ]] } description=""/> +list[ Statement [ TSCodeBlock ]] } description=""/> ### get_variable_usages Returns all instances of variable usages in a code block. - + -list[ Editable [ TSCodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> +list[ Editable [ TSCodeBlock ]] } description="A sorted list of variable usage instances as Editable objects."/> ### indent Adjusts the indentation level of the entire code block. - + None } description=""/> +### insert_after +Inserts source code at the bottom of the code block. + + + +str } + description="The source code to insert." + defaultValue="" +/> +bool } + description="Whether to fix the indentation of the inserted code. Defaults to True." + defaultValue="True" +/> +bool } + description="Whether to add a newline before the inserted code. Defaults to True." + defaultValue="True" +/> + + + +None } description=""/> + + ### 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=""/> @@ -409,15 +438,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -425,7 +454,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### unwrap Unwraps a code block by removing its opening and closing braces. - + None } description=""/> @@ -561,7 +590,7 @@ Unwraps a code block by removing its opening and closing braces. ### wrap Wraps a code block with a statement and indents it. - + + ### Inherits from [Comment](/api-reference/core/Comment), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -53,11 +53,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns a list of nested code blocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSComment ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -105,22 +105,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### clean_comment Cleans comment markers and whitespace from a comment string. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSComment ] } description=""/> +CodeFlag[ TSComment ] } description=""/> ### generate_comment Generates a TypeScript comment block from the given text content. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +391,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -407,7 +407,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSCommentGroup.mdx b/docs/api-reference/typescript/TSCommentGroup.mdx index 39d9ae282..6db4d63c6 100644 --- a/docs/api-reference/typescript/TSCommentGroup.mdx +++ b/docs/api-reference/typescript/TSCommentGroup.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [CommentGroup](/api-reference/core/CommentGroup), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -50,15 +50,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -72,15 +72,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### source @@ -88,7 +88,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### text @@ -101,22 +101,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ TSCommentGroup ] } description=""/> +CodeFlag[ TSCommentGroup ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,15 +335,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -351,7 +351,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/typescript/TSCommentType.mdx b/docs/api-reference/typescript/TSCommentType.mdx index b6f114aad..a92e1f600 100644 --- a/docs/api-reference/typescript/TSCommentType.mdx +++ b/docs/api-reference/typescript/TSCommentType.mdx @@ -21,7 +21,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/typescript/TSConditionalType.mdx b/docs/api-reference/typescript/TSConditionalType.mdx index 54e84002d..672f181d8 100644 --- a/docs/api-reference/typescript/TSConditionalType.mdx +++ b/docs/api-reference/typescript/TSConditionalType.mdx @@ -15,7 +15,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,12 +24,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -TSType[ TSConditionalType ] } description=" +TSType[ TSConditionalType ] } description=" " /> ### consequence -TSType[ TSConditionalType ] } description=" +TSType[ TSConditionalType ] } description=" " /> ### extended @@ -55,11 +55,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### left -TSType[ TSConditionalType ] } description=" +TSType[ TSConditionalType ] } description=" " /> ### node_type @@ -74,23 +74,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### right -TSType[ TSConditionalType ] } description=" +TSType[ TSConditionalType ] } description=" " /> ### source @@ -104,22 +104,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSConditionalType ] } description=""/> +CodeFlag[ TSConditionalType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +321,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSConfig.mdx b/docs/api-reference/typescript/TSConfig.mdx index 50f6427c9..6e740a61a 100644 --- a/docs/api-reference/typescript/TSConfig.mdx +++ b/docs/api-reference/typescript/TSConfig.mdx @@ -11,14 +11,14 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes ### base_config -TSConfig | None } description="Returns the base TSConfig that this config inherits from." /> +TSConfig | None } description="Returns the base TSConfig that this config inherits from." /> ### base_url @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### references -list[ Directory | File ] } description="Returns a list of directories that this TypeScript configuration file depends on." /> +list[ Directory | File ] } description="Returns a list of directories that this TypeScript configuration file depends on." /> ### root_dir @@ -72,7 +72,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolve_base_url Resolves an import path with the base url. - + str } description=""/> @@ -80,7 +80,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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call -FunctionCall | None } description="Retrieves the function call expression associated with the decorator." /> +FunctionCall | None } description="Retrieves the function call expression associated with the decorator." /> ### extended @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,22 +92,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSDecorator ] } description=""/> +CodeFlag[ TSDecorator ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +317,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Dict](/api-reference/core/Dict), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -55,19 +55,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -80,27 +80,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### unpack -Unpack [ TSObjectType ] | None } description=" +Unpack [ TSObjectType ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSDict ] } description=""/> +CodeFlag[ TSDict ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +302,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -318,7 +318,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSEnum.mdx b/docs/api-reference/typescript/TSEnum.mdx index f8d00a7da..9026ba588 100644 --- a/docs/api-reference/typescript/TSEnum.mdx +++ b/docs/api-reference/typescript/TSEnum.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 [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) @@ -20,11 +20,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attributes -list[ TSAttribute [ TSEnum , None]] } description="Property that retrieves the attributes of a TypeScript enum." /> +list[ TSAttribute [ TSEnum , None]] } description="Property that retrieves the attributes of a TypeScript enum." /> ### body -Expression [ TSEnum ] } description=" +Expression [ TSEnum ] } description=" " /> ### code_block @@ -34,23 +34,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -62,7 +62,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### has_semicolon @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_decorated @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSEnum ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSEnum ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -129,23 +129,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -163,14 +163,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSEnum ] } description=""/> +CodeFlag[ TSEnum ] } description=""/> ### get_attribute Returns an attribute from the TypeScript enum by its name. - + -TSAttribute | None } description="The attribute with the given name if it exists, None otherwise."/> +TSAttribute | None } description="The attribute with the given name if it exists, None otherwise."/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSEnum ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSEnum ] | None } description="The matching JSX element if found, None otherwise."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -521,7 +538,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -566,7 +583,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -700,7 +740,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSExport.mdx b/docs/api-reference/typescript/TSExport.mdx index 32a636cf6..862ab388e 100644 --- a/docs/api-reference/typescript/TSExport.mdx +++ b/docs/api-reference/typescript/TSExport.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), [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) @@ -20,19 +20,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### declared_symbol -TSSymbol | TSImport | None } description="Returns the symbol that was defined in this export." /> +TSSymbol | TSImport | None } description="Returns the symbol that was defined in this export." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### descendant_symbols -list[ Importable ] } description="Returns a list of all descendant symbols from this export's declared symbol." /> +list[ Importable ] } description="Returns a list of all descendant symbols from this export's declared symbol." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### export_statement @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### exported_symbol -Exportable | None } description="Returns the symbol, file, or import being exported from this export object." /> +Exportable | None } description="Returns the symbol, file, or import being exported from this export object." /> ### extended @@ -74,7 +74,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### is_exported @@ -104,23 +104,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_symbol -Exportable | None } description="Returns the Symbol, SourceFile or External module that this export resolves to." /> +Exportable | None } description="Returns the Symbol, SourceFile or External module that this export resolves to." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -133,26 +133,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSExport ] } description=""/> +CodeFlag[ TSExport ] } description=""/> ### get_import_string Returns the import string for this export. - + 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 +397,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 +405,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 +430,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 +438,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 +463,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 +471,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 +479,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,15 +487,15 @@ 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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -503,15 +503,15 @@ 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."/> +TSImport | None } description="The import object being re-exported, or None if this is not a re-export or no import was found."/> ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### 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'`"/> @@ -669,19 +692,19 @@ Converts this export into its equivalent import string representation. ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSExpressionType.mdx b/docs/api-reference/typescript/TSExpressionType.mdx index 35b2f4fa0..e79e9b22d 100644 --- a/docs/api-reference/typescript/TSExpressionType.mdx +++ b/docs/api-reference/typescript/TSExpressionType.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -24,7 +24,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### expression -Expression [ TSExpressionType [ Editable ]] } description="The expression to evaluate that yields the type" /> +Expression [ TSExpressionType [ Editable ]] } description="The expression to evaluate that yields the type" /> ### extended @@ -53,7 +53,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSExpressionType ] } description=""/> +CodeFlag[ TSExpressionType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +321,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Exportable](/api-reference/core/Exportable), [TSHasBlock](/api-reference/typescript/TSHasBlock), [SourceFile](/api-reference/core/SourceFile), [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ Class ] } description="Returns all Classes in the file." /> +list[ Class ] } description="Returns all Classes in the file." /> ### code_block @@ -33,31 +33,31 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### default_exports -list[ TSExport ] } description="Returns all default export symbols from the file." /> +list[ TSExport ] } description="Returns all default export symbols from the file." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### directory -Directory | None } description="Returns the directory that contains this file." /> +Directory | None } description="Returns the directory that contains this file." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### export_statements -list[ ExportStatement [ TSExport ]] } description="Returns a list of all export statements in the file." /> +list[ ExportStatement [ TSExport ]] } description="Returns a list of all export statements in the file." /> ### exported_name @@ -65,7 +65,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### exports -list[ TSExport ] } description="Returns all Export symbols in the file." /> +list[ TSExport ] } description="Returns all Export symbols in the file." /> ### extended @@ -103,15 +103,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### functions -list[ Function ] } description="Returns all Functions in the file." /> +list[ Function ] } description="Returns all Functions in the file." /> ### global_vars -list[ Assignment ] } description="Returns all GlobalVars in the file." /> +list[ Assignment ] } description="Returns all GlobalVars in the file." /> ### import_module_name @@ -119,23 +119,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### import_statements -list[ ImportStatement ] } description="Returns all ImportStatements in the file, where each import statement can contain" /> +list[ ImportStatement ] } 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[ Import ] } description="Returns all imports that directly imports this file as a module." /> ### imports -list[ Import ] } description="List of all Imports in this file." /> +list[ Import ] } 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[ Import ] } description="Returns all imports that are importing symbols contained in this file." /> ### interfaces -list[ TSInterface ] } description="Returns all Interfaces in the file." /> +list[ TSInterface ] } description="Returns all Interfaces in the file." /> ### is_binary @@ -155,7 +155,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSFile ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSFile ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -163,7 +163,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### named_exports -list[ TSExport ] } description="Returns the named exports declared in the file." /> +list[ TSExport ] } description="Returns the named exports declared in the file." /> ### node_type @@ -181,15 +181,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### path @@ -203,7 +203,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -215,11 +215,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[ Symbol ] } description="Returns all Symbols in the file, sorted topologically (parents first). Robust to" /> ### ts_config -TSConfig | None } description=" +TSConfig | None } description=" " /> ### ts_node @@ -229,18 +229,18 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### types -list[ TSTypeAlias ] } description="Returns all type aliases in the file." /> +list[ TSTypeAlias ] } description="Returns all type aliases in the file." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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. - + None } description=""/> +### add_symbol +Adds `symbol` to the file. + + + +Symbol } + description="The symbol to add to the file." + defaultValue="" +/> +bool, optional } + description="Whether to export the symbol. Defaults to True." + defaultValue="True" +/> + + + +Symbol | 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. - + None } description="The symbol is added directly to the file's content."/> +### add_symbol_import +Adds an import to a file for a given symbol. + + + +Symbol } + description="The symbol to import." + defaultValue="" +/> +str | None } + description="Optional alias for the imported symbol. Defaults to None." + defaultValue="None" +/> +ImportType } + description="The type of import to use. Defaults to ImportType.UNKNOWN." + defaultValue="ImportType.UNKNOWN" +/> +bool } + description="Whether this is a type-only import. Defaults to False." + defaultValue="False" +/> + + + +Import | 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +list[ Editable ] } description="A list of Editable instances that match the search criteria."/> ### find_by_byte_range Finds all editable objects that overlap with the given byte range in the file. - + -list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> +list[ Editable ] } description="A list of all Editable objects that overlap with the given range."/> ### find_string_literals Returns a list of string literals within this node's source that match any of the given - + -list[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSFile ] } description=""/> +CodeFlag[ TSFile ] } description=""/> ### 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."/> +Class | None } description="The matching Class object if found, None otherwise."/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSFile ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSFile ] | None } description="The matching JSX element if found, None otherwise."/> ### get_config Returns the nearest tsconfig.json applicable to this file. - + -TSConfig | None } description="The TypeScript configuration object if found, None otherwise."/> +TSConfig | None } description="The TypeScript configuration object if found, None otherwise."/> ### get_export Returns an export object with the specified name from the file. - + -TSExport | None } description="The export object if found, None otherwise."/> +TSExport | None } description="The export object if found, None otherwise."/> ### get_export_statement_for_path Gets the first export of specified type that contains the given path in single or double quotes. - + -ExportStatement | None } description="The first matching export if found, None otherwise."/> +ExportStatement | None } description="The first matching export if found, None otherwise."/> ### 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'."/> @@ -518,7 +576,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."/> +Function | 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."/> +Assignment | 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."/> +Import | 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. - + get_interface Retrieves a specific interface from the file by its name. - + -TSInterface | None } description="The interface with the specified name if found, None otherwise."/> +TSInterface | None } description="The interface with the specified name if found, None otherwise."/> ### 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."/> +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_namespace Returns a specific namespace by name from the file's namespaces. - + -TSNamespace | None } description="The namespace with the specified name if found, None otherwise."/> +TSNamespace | None } description="The namespace with the specified name if found, None otherwise."/> ### get_symbol Gets a symbol by its name from the file. - + -Symbol | None } description="The found symbol, or None if not found."/> +Symbol | None } description="The found symbol, or None if not found."/> ### get_type Returns a specific Type by name from the file's types. - + -TSTypeAlias | None } description="The TypeScript type alias with the matching name, or None if not found."/> +TSTypeAlias | None } description="The TypeScript type alias with the matching name, or None if not found."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -833,15 +891,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -849,7 +907,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -857,15 +915,38 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a code element. - + set_name Sets the name of a code element. - + symbol_can_be_added Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### 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 | 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"/> + + +### update_filepath +Updates the file path of the current file and all associated imports. + + + +str } + description="The new file path to move the file to." + defaultValue="" +/> + + + +None } description=""/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSForLoopStatement.mdx b/docs/api-reference/typescript/TSForLoopStatement.mdx index d9b4f562b..82d0ab31d 100644 --- a/docs/api-reference/typescript/TSForLoopStatement.mdx +++ b/docs/api-reference/typescript/TSForLoopStatement.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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,20 +29,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ TSForLoopStatement ] | None } description="The condition for the loop. Applicable for traditional for loops." /> +Expression [ TSForLoopStatement ] | None } description="The condition for the loop. Applicable for traditional for loops." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -67,11 +67,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Retrieves all function calls within a for loop statement." /> +list[ FunctionCall ] } description="Retrieves all function calls within a for loop statement." /> ### increment -Expression [ TSForLoopStatement ] | None } description="The increment expression. Applicable for traditional for loops." /> +Expression [ TSForLoopStatement ] | None } description="The increment expression. Applicable for traditional for loops." /> ### index @@ -79,7 +79,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### initializer -Expression [ TSForLoopStatement ] | None } description="The counter variable. Applicable for traditional for loops." /> +Expression [ TSForLoopStatement ] | None } description="The counter variable. Applicable for traditional for loops." /> ### is_decorated @@ -91,23 +91,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### item -Expression [ TSForLoopStatement ] | None } description="An item in the iterable object. Only applicable for `for...of` loops." /> +Expression [ TSForLoopStatement ] | None } description="An item in the iterable object. Only applicable for `for...of` loops." /> ### iterable -Expression [ TSForLoopStatement ] | None } description="The iterable that is being iterated over. Only applicable for `for...of` loops." /> +Expression [ TSForLoopStatement ] | None } description="The iterable that is being iterated over. Only applicable for `for...of` loops." /> ### jsx_elements -list[ JSXElement [ TSForLoopStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSForLoopStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSForLoopStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -121,19 +121,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -151,14 +151,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSForLoopStatement ] } description=""/> +CodeFlag[ TSForLoopStatement ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSForLoopStatement ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSForLoopStatement ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +408,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -424,7 +424,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### call_sites -list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> +list[ FunctionCall ] } description="Returns all call sites (invocations) of this callable in the codebase." /> ### code_block @@ -28,23 +28,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -81,7 +81,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> +list[ FunctionCall ] } description="Gets all function calls within the function and its parameters." /> ### function_signature @@ -101,7 +101,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_anonymous @@ -157,7 +157,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSFunction ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSFunction ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -165,7 +165,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_functions -list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> +list[ Function ] } description="Returns a list of nested functions defined within this function's code block." /> ### node_type @@ -174,7 +174,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -SymbolGroup [ Parameter , TSFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> +SymbolGroup [ Parameter , TSFunction ] | list[ Parameter ] } description="Retrieves all parameters of a callable symbol." /> ### parent @@ -183,32 +183,32 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_statements -list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> +list[ ReturnStatement ] } description="Returns a list of all return statements within this function's body." /> ### return_type -Type | Placeholder[ ExternalModule ] } description=" +Type | Placeholder [ ExternalModule ] } description=" " /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -226,19 +226,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> + + ### 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=""/> +list[ Editable ] } description=""/> ### 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=""/> @@ -346,7 +363,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=""/> @@ -354,7 +371,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSFunction ] } description=""/> +CodeFlag[ TSFunction ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSFunction ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSFunction ] | None } description="The matching JSX element if found, None otherwise."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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_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."/> +Parameter | 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."/> +Parameter | 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. - + -Parameter | None } description="The parameter with the specified type, or None if no parameter is found or if the callable has no parameters."/> +Parameter | 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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + None } description=""/> +### insert_statements +Inserts lines of code into the function body at the specified index. + + + +str } + description="The code lines to insert into the function body." + defaultValue="" +/> +int, optional } + description="The position in the function body where the lines should be inserted. Defaults to 0." + defaultValue="0" +/> + + + +None } description=""/> + + ### 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=""/> @@ -690,7 +730,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=""/> +Editable | None } description=""/> ### prepend_statements Prepends the provided code to the beginning of the function body. - + reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -752,7 +792,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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."/> + + ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -915,7 +978,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSFunctionType.mdx b/docs/api-reference/typescript/TSFunctionType.mdx index 602caac4f..53c689996 100644 --- a/docs/api-reference/typescript/TSFunctionType.mdx +++ b/docs/api-reference/typescript/TSFunctionType.mdx @@ -18,7 +18,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) @@ -48,7 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -62,7 +62,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -Collection[ TSParameter , TSFunctionType ] } description="Retrieves the parameters of a function type." /> +Collection[ TSParameter , TSFunctionType ] } description="Retrieves the parameters of a function type." /> ### parent @@ -71,23 +71,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### return_type -TSType[ TSFunctionType ] | TSReturnTypePlaceholder [ TSFunctionType ] } description="Return type of the function." /> +TSType[ TSFunctionType ] | TSReturnTypePlaceholder [ TSFunctionType ] } description="Return type of the function." /> ### source @@ -100,22 +100,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### asyncify Modifies the function type to be asynchronous by wrapping its return type in a Promise. - + None } description=""/> @@ -123,7 +123,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSFunctionType ] } description=""/> +CodeFlag[ TSFunctionType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +325,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -341,7 +341,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSGenericType.mdx b/docs/api-reference/typescript/TSGenericType.mdx index d7f6d1837..2d232017d 100644 --- a/docs/api-reference/typescript/TSGenericType.mdx +++ b/docs/api-reference/typescript/TSGenericType.mdx @@ -15,7 +15,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) @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -62,7 +62,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parameters -Collection[ Type , TSGenericType ] } description="Retrieves the generic type parameters associated with this type." /> +Collection[ Type , TSGenericType ] } description="Retrieves the generic type parameters associated with this type." /> ### parent @@ -71,19 +71,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSGenericType ] } description=""/> +CodeFlag[ TSGenericType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +321,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -30,11 +30,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -59,7 +59,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### is_decorated @@ -67,7 +67,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSHasBlock ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSHasBlock ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### node_type @@ -81,19 +81,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -106,14 +106,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSHasBlock ] } description=""/> +CodeFlag[ TSHasBlock ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSHasBlock ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSHasBlock ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +363,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -379,7 +379,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -30,11 +30,11 @@ 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[ IfBlockStatement ] } 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 [ PyIfBlockStatement ] | None } description="The condition expression for the if block. None if the block is an else block." /> ### consequence_block @@ -42,7 +42,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### else_statement -IfBlockStatement | None } description="Returns the else block within the if-statement." /> +IfBlockStatement | None } description="Returns the else block within the if-statement." /> ### extended @@ -67,7 +67,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> +list[ FunctionCall ] } description="Returns all function calls within the if block statement and its alternative blocks." /> ### index @@ -87,11 +87,11 @@ 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[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSIfBlockStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -105,19 +105,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -135,22 +135,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### 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[ IfBlockStatement ] } 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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSIfBlockStatement ] } description=""/> +CodeFlag[ TSIfBlockStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +360,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSImport.mdx b/docs/api-reference/typescript/TSImport.mdx index 8803fdf99..23ade18f8 100644 --- a/docs/api-reference/typescript/TSImport.mdx +++ b/docs/api-reference/typescript/TSImport.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 [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,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alias -Editable | None } description=" +Editable | None } description=" " /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -58,7 +58,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### from_file -SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> +SourceFile | None } description="Returns the SourceFile that an Import is importing from." /> ### full_name @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### import_specifier @@ -83,11 +83,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### imported_exports -list[ Exportable ] } description="Returns the enumerated list of exports imported from a module import." /> +list[ Exportable ] } description="Returns the enumerated list of exports imported from a module import." /> ### imported_symbol -Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> +Symbol | ExternalModule | SourceFile | Import | None } description="Returns the symbol directly being imported, including an indirect import and an External" /> ### is_exported @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### module -Editable | None } description=" +Editable | None } description=" " /> ### name @@ -122,23 +122,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_symbol -Symbol | ExternalModule | TSFile | None } description="Returns the resolved symbol that the import is referencing." /> +Symbol | ExternalModule | TSFile | None } description="Returns the resolved symbol that the import is referencing." /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -146,7 +146,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbol_name -Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> +Editable | None } description="The name of the symbol being imported. For instance import a as b has a symbol_name of a." /> ### to_file @@ -164,22 +164,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSImport ] } description=""/> +CodeFlag[ TSImport ] } description=""/> ### get_import_string Generates an import string for an import statement. - + 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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 +424,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 +466,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 +474,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 +482,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 +490,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,15 +498,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -514,7 +514,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. - + -ImportResolution[ TSFile ] | None } description="An ImportResolution object containing the resolved file and symbol, or None if the import could not be resolved (treated as an external module). The ImportResolution contains: - from_file: The file being imported from - symbol: The specific symbol being imported (None for module imports) - imports_file: True if importing the entire file/module"/> +ImportResolution[ TSFile ] | None } description="An ImportResolution object containing the resolved file and symbol, or None if the import could not be resolved (treated as an external module). The ImportResolution contains: - from_file: The file being imported from - symbol: The specific symbol being imported (None for module imports) - imports_file: True if importing the entire file/module"/> ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSImportStatement.mdx b/docs/api-reference/typescript/TSImportStatement.mdx index ff9df1c64..a7977c0f7 100644 --- a/docs/api-reference/typescript/TSImportStatement.mdx +++ b/docs/api-reference/typescript/TSImportStatement.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -50,11 +50,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### imports -Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> +Collection[ Import , PyImportStatement ] } description="A collection of the individual imports this statement represents" /> ### index @@ -62,11 +62,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TSImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TSImportStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -80,19 +80,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -110,22 +110,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSImportStatement ] } description=""/> +CodeFlag[ TSImportStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +327,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -343,7 +343,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSInterface.mdx b/docs/api-reference/typescript/TSInterface.mdx index fd0409ea9..a1dba328a 100644 --- a/docs/api-reference/typescript/TSInterface.mdx +++ b/docs/api-reference/typescript/TSInterface.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -25,7 +25,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attributes -list[ TSAttribute ] } description="Retrieves the list of attributes defined in the TypeScript interface." /> +list[ TSAttribute ] } description="Retrieves the list of attributes defined in the TypeScript interface." /> ### code_block @@ -33,23 +33,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -61,7 +61,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -86,7 +86,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### has_semicolon @@ -94,7 +94,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_decorated @@ -110,7 +110,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSInterface ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSInterface ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -128,27 +128,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_interfaces -Parents[ Type , TSInterface ] | None } description="All the interfaces that this interface extends." /> +Parents[ Type , TSInterface ] | None } description="All the interfaces that this interface extends." /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -166,19 +166,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + extends Returns True if the interface implements the given parent interface. - + bool } description=""/> @@ -287,7 +304,7 @@ Returns True if the interface implements the given parent interface. ### find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSInterface ] } description=""/> +CodeFlag[ TSInterface ] } description=""/> ### get_attribute Returns the attribute with the given name, if it exists. - + -Attribute | None } description=""/> +Attribute | None } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSInterface ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSInterface ] | None } description="The matching JSX element if found, None otherwise."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +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[Interface | Class ] } description=""/> +list[Interface | Class ] } 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=""/> @@ -536,7 +553,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -581,7 +598,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -715,7 +755,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSLabeledStatement.mdx b/docs/api-reference/typescript/TSLabeledStatement.mdx index 268be2e42..5e9b308b5 100644 --- a/docs/api-reference/typescript/TSLabeledStatement.mdx +++ b/docs/api-reference/typescript/TSLabeledStatement.mdx @@ -27,7 +27,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasName](/api-reference/core/HasName), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -36,7 +36,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### body -Expression | None } description=" +Expression | None } description=" " /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -82,11 +82,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ Editable ] } description="Returns all nested code blocks within the statement." /> +list[ Editable ] } description="Returns all nested code blocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TSLabeledStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TSLabeledStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -100,19 +100,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -130,22 +130,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSLabeledStatement ] } description=""/> +CodeFlag[ TSLabeledStatement ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +355,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -371,7 +371,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### lookup @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -92,27 +92,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -TSType[ TSLookupType ] } description=" +TSType[ TSLookupType ] } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSLookupType ] } description=""/> +CodeFlag[ TSLookupType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +314,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -330,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSNamedType.mdx b/docs/api-reference/typescript/TSNamedType.mdx index c8296b9bb..e1609e8aa 100644 --- a/docs/api-reference/typescript/TSNamedType.mdx +++ b/docs/api-reference/typescript/TSNamedType.mdx @@ -14,7 +14,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -48,7 +48,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -66,19 +66,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -91,22 +91,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSNamedType ] } description=""/> +CodeFlag[ TSNamedType ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +316,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -332,7 +332,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + + ### Inherits from [HasName](/api-reference/core/HasName), [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### classes -list[ TSClass ] } description="Get all classes defined in this namespace." /> +list[ TSClass ] } description="Get all classes defined in this namespace." /> ### code_block @@ -29,23 +29,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -82,11 +82,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### functions -list[ TSFunction ] } description="Get all functions defined in this namespace." /> +list[ TSFunction ] } description="Get all functions defined in this namespace." /> ### has_semicolon @@ -94,7 +94,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_decorated @@ -110,7 +110,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSNamespace ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSNamespace ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -128,23 +128,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -157,7 +157,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Symbol ] } description="Returns all symbols defined within this namespace, including nested ones." /> +list[ Symbol ] } description="Returns all symbols defined within this namespace, including nested ones." /> ### ts_node @@ -166,14 +166,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSNamespace ] } description=""/> +CodeFlag[ TSNamespace ] } description=""/> ### get_class Get a class by name from this namespace. - + -TSClass | None } description=""/> +TSClass | None } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSNamespace ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSNamespace ] | None } description="The matching JSX element if found, None otherwise."/> ### get_enum Get an enum by name from this namespace. - + -TSEnum | None } description=""/> +TSEnum | None } description=""/> ### get_function Get a function by name from this namespace. - + -TSFunction | None } description="The found function, or None if not found"/> +TSFunction | None } description="The found function, or None if not found"/> ### get_import_string Generates the appropriate import string for a symbol. - + get_interface Get an interface by name from this namespace. - + -TSInterface | None } description=""/> +TSInterface | 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."/> +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_namespace Get a namespace by name from this namespace. - + -TSNamespace | None } description="The found namespace, or None if not found"/> +TSNamespace | None } description="The found namespace, or None if not found"/> ### get_nested_namespaces Get all nested namespaces within this namespace. - + -list[ TSNamespace ] } description="List of all nested namespace objects"/> +list[ TSNamespace ] } description="List of all nested namespace objects"/> ### get_symbol Get a symbol by name from this namespace. - + -Symbol | None } description="The found symbol, or None if not found"/> +Symbol | None } description="The found symbol, or None if not found"/> ### get_type Get a type alias by name from this namespace. - + -TSTypeAlias | None } description=""/> +TSTypeAlias | None } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -571,7 +588,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -616,7 +633,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -767,7 +784,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSObjectType.mdx b/docs/api-reference/typescript/TSObjectType.mdx index f5cdac30b..a89d72f7f 100644 --- a/docs/api-reference/typescript/TSObjectType.mdx +++ b/docs/api-reference/typescript/TSObjectType.mdx @@ -17,7 +17,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), [TSDict](/api-reference/typescript/TSDict), [Expression](/api-reference/core/Expression), [Dict](/api-reference/core/Dict), [Editable](/api-reference/core/Editable) @@ -47,7 +47,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -61,19 +61,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -86,27 +86,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### unpack -Unpack [ TSObjectType ] | None } description=" +Unpack [ TSObjectType ] | None } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSObjectType ] } description=""/> +CodeFlag[ TSObjectType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +308,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -324,7 +324,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSPair.mdx b/docs/api-reference/typescript/TSPair.mdx index fafc74f5c..b0bf6b4bb 100644 --- a/docs/api-reference/typescript/TSPair.mdx +++ b/docs/api-reference/typescript/TSPair.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Pair](/api-reference/core/Pair), [HasValue](/api-reference/core/HasValue), [Editable](/api-reference/core/Editable) @@ -50,7 +50,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### key @@ -73,15 +73,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### shorthand @@ -98,26 +98,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSPair ] } description=""/> +CodeFlag[ TSPair ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +319,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -335,7 +335,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_value Sets the value of the node's value Expression. - + + ### Inherits from -[Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Typeable](/api-reference/core/Typeable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) +[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) ## Attributes @@ -32,7 +32,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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### extended @@ -61,7 +61,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### index @@ -99,19 +99,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -124,30 +124,30 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> +Type | TypePlaceholder [ PyParameter ] } description="The type annotation associated with this node" /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### convert_to_interface Converts a parameter's inline type definition to an interface. - + None } description=""/> @@ -155,7 +155,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. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSParameter ] } description=""/> +CodeFlag[ TSParameter ] } 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."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +365,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -381,7 +381,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSQueryType.mdx b/docs/api-reference/typescript/TSQueryType.mdx index e8aec772c..dfd567c0e 100644 --- a/docs/api-reference/typescript/TSQueryType.mdx +++ b/docs/api-reference/typescript/TSQueryType.mdx @@ -15,7 +15,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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -63,24 +63,24 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### query -TSType[ TSQueryType ] } description=" +TSType[ TSQueryType ] } description=" " /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -93,22 +93,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSQueryType ] } description=""/> +CodeFlag[ TSQueryType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +310,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -326,7 +326,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSReadonlyType.mdx b/docs/api-reference/typescript/TSReadonlyType.mdx index 03e5c151b..c840b9246 100644 --- a/docs/api-reference/typescript/TSReadonlyType.mdx +++ b/docs/api-reference/typescript/TSReadonlyType.mdx @@ -15,7 +15,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) @@ -45,7 +45,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### name @@ -63,19 +63,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -88,27 +88,27 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type -TSType[ TSReadonlyType ] } description=" +TSType[ TSReadonlyType ] } description=" " /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSReadonlyType ] } description=""/> +CodeFlag[ TSReadonlyType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +310,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -326,7 +326,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSReturnTypePlaceholder.mdx b/docs/api-reference/typescript/TSReturnTypePlaceholder.mdx index 5cce8491b..edf3b0f34 100644 --- a/docs/api-reference/typescript/TSReturnTypePlaceholder.mdx +++ b/docs/api-reference/typescript/TSReturnTypePlaceholder.mdx @@ -16,7 +16,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -26,7 +26,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Modifies the return type annotation of a function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/typescript/TSString.mdx b/docs/api-reference/typescript/TSString.mdx index bbc2ab0ec..7e87c7d7d 100644 --- a/docs/api-reference/typescript/TSString.mdx +++ b/docs/api-reference/typescript/TSString.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -33,12 +33,12 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### content_nodes -Collection[ Expression [ Editable ], PyString ] } description=" +Collection[ Expression [ Editable ], PyString ] } description=" " /> ### 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 @@ -63,7 +63,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -77,19 +77,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -102,7 +102,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ### with_quotes @@ -113,15 +113,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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSString ] } description=""/> +CodeFlag[ TSString ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +323,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -339,7 +339,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSSwitchCase.mdx b/docs/api-reference/typescript/TSSwitchCase.mdx index b2ef8b6a2..710542375 100644 --- a/docs/api-reference/typescript/TSSwitchCase.mdx +++ b/docs/api-reference/typescript/TSSwitchCase.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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,16 +24,16 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### condition -Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> +Expression [ PyMatchCase ] | None } description="The condition which triggers this case" /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### default @@ -41,7 +41,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> +list[ FunctionCall ] } description="Gets all function calls within the statement's code block." /> ### index @@ -78,15 +78,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSSwitchCase ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSSwitchCase ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSSwitchCase ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -100,19 +100,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -130,14 +130,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSSwitchCase ] } description=""/> +CodeFlag[ TSSwitchCase ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSSwitchCase ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSSwitchCase ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +387,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### cases -list[ SwitchCase ] } description=" +list[ SwitchCase ] } description=" " /> ### extended @@ -46,7 +46,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> +list[ FunctionCall ] } description="Returns all function calls within the switch statement." /> ### index @@ -54,11 +54,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the switch statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSSwitchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -72,19 +72,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -102,26 +102,26 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### value -Expression [ PyMatchStatement ] } description="The value to switch on" /> +Expression [ PyMatchStatement ] } description="The value to switch on" /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSSwitchStatement ] } description=""/> +CodeFlag[ TSSwitchStatement ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +323,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -339,7 +339,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSSymbol.mdx b/docs/api-reference/typescript/TSSymbol.mdx index fb7164451..1a9dbb377 100644 --- a/docs/api-reference/typescript/TSSymbol.mdx +++ b/docs/api-reference/typescript/TSSymbol.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -29,15 +29,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +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[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -49,7 +49,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -74,7 +74,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### has_semicolon @@ -82,7 +82,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_exported @@ -108,23 +108,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -142,14 +142,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + None } description=""/> +### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSSymbol ] } description=""/> +CodeFlag[ TSSymbol ] } description=""/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -443,7 +460,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -488,7 +505,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -622,7 +662,7 @@ Sets a comment to the symbol. ### set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSTernaryExpression.mdx b/docs/api-reference/typescript/TSTernaryExpression.mdx index 62c5826d2..a56daa26b 100644 --- a/docs/api-reference/typescript/TSTernaryExpression.mdx +++ b/docs/api-reference/typescript/TSTernaryExpression.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,17 +20,17 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### alternative -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### condition -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### consequence -Expression [ PyConditionalExpression ] | None } description=" +Expression [ PyConditionalExpression ] | None } description=" " /> ### extended @@ -56,7 +56,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -70,19 +70,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -95,22 +95,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSTernaryExpression ] } description=""/> +CodeFlag[ TSTernaryExpression ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +312,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + Editable | None, optional } + type={ <>Editable | None, optional } description="The node to be edited. Defaults to None." defaultValue="None" /> @@ -343,7 +343,7 @@ 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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSTryCatchStatement.mdx b/docs/api-reference/typescript/TSTryCatchStatement.mdx index 5f4b1471c..e1e34dc76 100644 --- a/docs/api-reference/typescript/TSTryCatchStatement.mdx +++ b/docs/api-reference/typescript/TSTryCatchStatement.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -24,20 +24,20 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### catch -TSCatchStatement [ TSTryCatchStatement ] | None } description="The catch block." /> +TSCatchStatement [ TSTryCatchStatement ] | None } description="The catch block." /> ### code_block -CodeBlock | None } description=" +CodeBlock | None } description=" " /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -62,11 +62,11 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### finalizer -BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> +BlockStatement | None } description="The code block executed regardless of if an exception is thrown or not" /> ### function_calls -list[ FunctionCall ] } description="Gets all function calls within a try-catch-finally statement." /> +list[ FunctionCall ] } description="Gets all function calls within a try-catch-finally statement." /> ### index @@ -78,15 +78,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSTryCatchStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSTryCatchStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ TSCodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> ### nested_statements -list[ MultiLineCollection [ Statement [ TSTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> +list[ MultiLineCollection [ Statement [ TSTryCatchStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -100,19 +100,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -130,14 +130,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSTryCatchStatement ] } description=""/> +CodeFlag[ TSTryCatchStatement ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSTryCatchStatement ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSTryCatchStatement ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +387,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### 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) @@ -20,7 +20,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### attributes -list[ TSAttribute ] } description="Retrieves all attributes belonging to this type alias." /> +list[ TSAttribute ] } description="Retrieves all attributes belonging to this type alias." /> ### code_block @@ -29,23 +29,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### comment -TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> +TSCommentGroup | None } description="Retrieves the comment group associated with the symbol." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### dependencies -list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> +list[Union[ Symbol , Import ]] } description="Returns a list of symbols that this symbol depends on." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### export -Export | None } description="Returns the export object that exports this symbol." /> +Export | None } description="Returns the export object that exports this symbol." /> ### exported_name @@ -57,7 +57,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### extended_nodes -list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> +list[ Editable ] } description="Returns the list of nodes associated with this symbol including extended nodes." /> ### extended_source @@ -82,7 +82,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> +list[ FunctionCall ] } description="Returns all function calls within the code block and its decorators." /> ### has_semicolon @@ -90,7 +90,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### inline_comment -TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> +TSCommentGroup | None } description="Property that retrieves the inline comment group associated with the symbol." /> ### is_decorated @@ -106,7 +106,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSTypeAlias ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSTypeAlias ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### name @@ -124,23 +124,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### semicolon_node -Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> +Editable | None } description="Retrieves the semicolon node associated with a TypeScript symbol." /> ### source @@ -158,23 +158,23 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### type_parameters -TypeParameters[ Type , TSTypeAlias ] | None } description=" +TypeParameters[ Type , TSTypeAlias ] | None } description=" " /> ### value -Expression | None } description="Gets the value node of the object." /> +Expression | None } description="Gets the value node of the object." /> ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this node with new_src. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSTypeAlias ] } description=""/> +CodeFlag[ TSTypeAlias ] } description=""/> ### get_attribute Retrieves a specific attribute from a TypeScript type alias by its name. - + -TSAttribute | None } description="The attribute with the specified name if found, None otherwise."/> +TSAttribute | None } description="The attribute with the specified name if found, None otherwise."/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSTypeAlias ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSTypeAlias ] | None } description="The matching JSX element if found, None otherwise."/> ### get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + -Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> +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 - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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=""/> @@ -525,7 +542,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=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -570,7 +587,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + 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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_comment Sets a comment to the symbol. - + TSCommentType , optional } + type={ <>TSCommentType , optional } description="The style of comment to add." defaultValue="TSCommentType.DOUBLE_SLASH" /> @@ -704,7 +744,7 @@ Sets a comment to the symbol. ### set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + UsageType | None } + type={ <>UsageType | None } description="The types of usages to search for. Defaults to any." defaultValue="None" /> -list[ Import | Symbol | Export ] } description="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."/> ### usages Returns a list of usages of the exportable object. - + UsageType | None } + type={ <>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."/> +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/typescript/TSUndefinedType.mdx b/docs/api-reference/typescript/TSUndefinedType.mdx index a1139c831..0639568f0 100644 --- a/docs/api-reference/typescript/TSUndefinedType.mdx +++ b/docs/api-reference/typescript/TSUndefinedType.mdx @@ -14,7 +14,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) @@ -44,7 +44,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### node_type @@ -58,19 +58,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -83,22 +83,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSUndefinedType ] } description=""/> +CodeFlag[ TSUndefinedType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +300,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -316,7 +316,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(). - + -list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> diff --git a/docs/api-reference/typescript/TSUnionType.mdx b/docs/api-reference/typescript/TSUnionType.mdx index 16fdea8c4..6fb224b01 100644 --- a/docs/api-reference/typescript/TSUnionType.mdx +++ b/docs/api-reference/typescript/TSUnionType.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### 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) @@ -45,15 +45,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> +list[ FunctionCall ] } description="Returns a list of all function calls contained within this expression." /> ### next_named_sibling -Editable | None } description="Returns the next named sibling of the last symbol in the group." /> +Editable | None } description="Returns the next named sibling of the last symbol in the group." /> ### next_sibling -Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> +Editable | None } description="Returns the next sibling of the last symbol in the symbol group." /> ### node_type @@ -67,19 +67,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### symbols -list[ Editable ] } description="Returns the list of symbols in the group." /> +list[ Editable ] } description="Returns the list of symbols in the group." /> ### ts_node @@ -96,22 +96,22 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### ancestors Find all ancestors of the node of the given type. Does not return itself - + -list[ Editable ] } description=""/> +list[ Editable ] } description=""/> ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -119,7 +119,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + -list[ Editable ] } description="A list of Editable objects representing each match found."/> +list[ Editable ] } description="A list of Editable objects representing each match found."/> ### find_string_literals Search for string literals matching given strings in the SymbolGroup. - + -list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> +list[ Editable ] } description="List of Editable nodes representing the matching string literals found within the symbols."/> ### flag Adds a visual flag comment to the end of this Editable's source text. - + -CodeFlag[ TSUnionType ] } description=""/> +CodeFlag[ TSUnionType ] } description=""/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### index Return the index of the first occurrence of value. - + int } description=""/> @@ -204,7 +204,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -212,7 +212,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,15 +302,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -318,12 +318,12 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + Editable | None } + type={ <>Editable | None } description="The element to remove from the Collection. If None, delegates to parent class." defaultValue="" /> @@ -335,7 +335,7 @@ Removes an element from a Collection. ### replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + -list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> +list[ Editable ] } description="A list of Editable objects representing matched text nodes in the codebase."/> diff --git a/docs/api-reference/typescript/TSWhileStatement.mdx b/docs/api-reference/typescript/TSWhileStatement.mdx index ec8e35576..1298ba880 100644 --- a/docs/api-reference/typescript/TSWhileStatement.mdx +++ b/docs/api-reference/typescript/TSWhileStatement.mdx @@ -19,7 +19,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -33,15 +33,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### condition -Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> +Expression [ TSWhileStatement ] } description="The condition expression of the while loop." /> ### decorators -list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> +list[ TSDecorator ] } description="Returns a list of decorators associated with this symbol." /> ### docstring -TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> +TSCommentGroup | None } description="Retrieves the docstring of a function or class." /> ### extended @@ -66,7 +66,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### function_calls -list[ FunctionCall ] } description="Returns all function calls within the while statement block." /> +list[ FunctionCall ] } description="Returns all function calls within the while statement block." /> ### index @@ -78,15 +78,15 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### jsx_elements -list[ JSXElement [ TSWhileStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> +list[ JSXElement [ TSWhileStatement ]] } description="Returns a list of all JSX elements contained within this symbol." /> ### nested_code_blocks -list[ CodeBlock ] } description="Returns all nested CodeBlocks within the statement." /> +list[ CodeBlock ] } 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." /> +list[ MultiLineCollection [ Statement [ TSWhileStatement ], Editable ]] } description="Returns a list of statement collections within nested code blocks." /> ### node_type @@ -100,19 +100,19 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### parent_class -Class | None } description="Find the class this node is contained in" /> +Class | None } description="Find the class this node is contained in" /> ### parent_function -Function | None } description="Find the function this node is contained in" /> +Function | None } description="Find the function this node is contained in" /> ### parent_statement -Statement | None } description="Find the statement this node is contained in" /> +Statement | None } description="Find the statement this node is contained in" /> ### resolved_value -Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> +Expression | list[ Expression ] } description="Returns the resolved type of an Expression." /> ### source @@ -130,14 +130,14 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### variable_usages -list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> +list[ Editable ] } description="Returns Editables for all TreeSitter node instances of variable usages within this node's" /> ## Methods ### 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=""/> +list[ Editable ] } description=""/> ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + -list[ Editable ] } description="A list of Editable instances that match the search criteria."/> +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[ Editable ] } description="A list of Editable objects representing the matching string literals."/> +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[ TSWhileStatement ] } description=""/> +CodeFlag[ TSWhileStatement ] } description=""/> ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + -JSXElement [ TSWhileStatement ] | None } description="The matching JSX element if found, None otherwise."/> +JSXElement [ TSWhileStatement ] | None } description="The matching JSX element if found, None otherwise."/> ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + -list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> +list[ Editable ] } description="List of Editable objects representing variable usage nodes matching the given name."/> ### 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,15 +387,15 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + -Editable | None } description=""/> +Editable | None } description=""/> ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> +list[ Editable ] } description="A list of Editable objects corresponding to the matches found."/> ### set_docstring Sets or updates a docstring for a code element. - + Class | None: + symbols = codebase.get_symbols(class_name) + if not symbols: + return None + + if len(symbols) == 1 and isinstance(symbols[0], Class): + return symbols[0] + + possible_classes = [s for s in symbols if isinstance(s, Class) and has_documentation(s)] + if not possible_classes: + return None + if len(possible_classes) == 1: + return possible_classes[0] + raise ValueError(f"Found {len(possible_classes)} classes with name {class_name}") + + def find_symbol(codebase: Codebase, symbol_name: str, resolved_types: list[Type], parent_class: Class, parent_symbol: Symbol, types_cache: dict): """Find the symbol in the codebase. @@ -201,35 +218,30 @@ def find_symbol(codebase: Codebase, symbol_name: str, resolved_types: list[Type] return f"<{create_path(parent_class)}>" if symbol_name in types_cache: return types_cache[symbol_name] - # if symbol_name in [resolved_type.value for resolved_type in resolved_types]: - # return symbol_name - - try: - trgt_symbol = None - cls_obj = codebase.get_class(symbol_name, optional=True) - if cls_obj: - trgt_symbol = cls_obj - - if not trgt_symbol: - if symbol := parent_symbol.file.get_symbol(symbol_name): - for resolved_type in symbol.resolved_types: - if isinstance(resolved_type, FunctionCall) and len(resolved_type.args) >= 2: - bound_arg = resolved_type.args[1] - bound_name = bound_arg.value - if cls_obj := codebase.get_class(bound_name, optional=True): - trgt_symbol = cls_obj - break - - elif symbol := codebase.get_symbol(symbol_name, optional=True): - if len(symbol.resolved_types) == 1: - trgt_symbol = symbol.resolved_types[0] - - if trgt_symbol and has_documentation(trgt_symbol): - trgt_path = f"<{create_path(trgt_symbol)}>" - types_cache[symbol_name] = trgt_path - return trgt_path - except Exception as e: - logger.warning(f"Unable to resolve {symbol_name}. Received error: {e}.") + + trgt_symbol = None + cls_obj = safe_get_class(codebase, symbol_name) + if cls_obj: + trgt_symbol = cls_obj + + if not trgt_symbol: + if symbol := parent_symbol.file.get_symbol(symbol_name): + for resolved_type in symbol.resolved_types: + if isinstance(resolved_type, FunctionCall) and len(resolved_type.args) >= 2: + bound_arg = resolved_type.args[1] + bound_name = bound_arg.value + if cls_obj := safe_get_class(codebase, bound_name): + trgt_symbol = cls_obj + break + + elif symbol := codebase.get_symbol(symbol_name, optional=True): + if len(symbol.resolved_types) == 1: + trgt_symbol = symbol.resolved_types[0] + + if trgt_symbol and isinstance(trgt_symbol, Callable) and has_documentation(trgt_symbol): + trgt_path = f"<{create_path(trgt_symbol)}>" + types_cache[symbol_name] = trgt_path + return trgt_path return symbol_name diff --git a/src/codegen/sdk/code_generation/mdx_docs_generation.py b/src/codegen/sdk/code_generation/mdx_docs_generation.py index 8a1ddb399..648a3b68e 100644 --- a/src/codegen/sdk/code_generation/mdx_docs_generation.py +++ b/src/codegen/sdk/code_generation/mdx_docs_generation.py @@ -197,7 +197,7 @@ def parse_link(type_string: str, href: bool = False) -> str: else: part = format_builtin_type_string(part) if href: - result.append(f'{part.strip()}') + result.append(f"{part.strip()}") else: result.append(part.strip()) diff --git a/src/codegen/sdk/codebase/flagging/enums.py b/src/codegen/sdk/codebase/flagging/enums.py index f89ad88f1..949f09ce5 100644 --- a/src/codegen/sdk/codebase/flagging/enums.py +++ b/src/codegen/sdk/codebase/flagging/enums.py @@ -23,6 +23,14 @@ class MessageType(IntFlag): @apidoc class FlagKwargs(TypedDict, total=False): + """Kwargs for the flag_instance method of the Codebase class. + + Attributes: + message: The message to be displayed in the diff preview or posted as a comment on the PR. + message_type: Where the message will be sent (CODEGEN, GITHUB, SLACK) + message_recipient: The recipient of the message. + """ + message: ReadOnly[str | None] message_type: ReadOnly[MessageType] message_recipient: ReadOnly[str | None] diff --git a/src/codegen/sdk/core/directory.py b/src/codegen/sdk/core/directory.py index 07c53d3f7..fc3ba9f99 100644 --- a/src/codegen/sdk/core/directory.py +++ b/src/codegen/sdk/core/directory.py @@ -195,7 +195,7 @@ def get_subdirectory(self, subdirectory_name: str) -> Self | None: """Get a subdirectory by its path relative to the directory.""" return self.items.get(subdirectory_name, None) - def remove(self): + def remove(self) -> None: """Remove the directory and all its files and subdirectories.""" for f in self.files: f.remove() diff --git a/src/codegen/sdk/core/expressions/parenthesized_expression.py b/src/codegen/sdk/core/expressions/parenthesized_expression.py index bf11454de..e4452a7c0 100644 --- a/src/codegen/sdk/core/expressions/parenthesized_expression.py +++ b/src/codegen/sdk/core/expressions/parenthesized_expression.py @@ -44,7 +44,7 @@ def function_calls(self) -> list[FunctionCall]: @writer @override - def unwrap(self, node: Expression | None = None): + def unwrap(self, node: Expression | None = None) -> None: """Removes the parentheses from a parenthesized expression node. Modifies the AST by removing the parentheses from a ParenthesizedExpression node, leaving only the inner expression. diff --git a/src/codegen/sdk/core/expressions/unpack.py b/src/codegen/sdk/core/expressions/unpack.py index c7a490f6c..8eb1c8a37 100644 --- a/src/codegen/sdk/core/expressions/unpack.py +++ b/src/codegen/sdk/core/expressions/unpack.py @@ -24,7 +24,7 @@ def __init__(self, ts_node, file_node_id, G, parent: Parent): super().__init__(ts_node, file_node_id, G, parent=parent) self._value_node = self.children[0] - def unwrap(self, node: Expression | None = None): + def unwrap(self, node: Expression | None = None) -> None: """Unwraps a node's content into its parent node. Unwraps the content of a node by removing its wrapping syntax and merging its content with its parent node. diff --git a/src/codegen/sdk/core/file.py b/src/codegen/sdk/core/file.py index 3f92531f1..e242636f4 100644 --- a/src/codegen/sdk/core/file.py +++ b/src/codegen/sdk/core/file.py @@ -839,7 +839,7 @@ def import_module_name(self) -> str: def get_import_module_name_for_file(cls, filepath: str, G: CodebaseGraph) -> str: ... @abstractmethod - def remove_unused_exports(self): + def remove_unused_exports(self) -> None: """Removes unused exports from the file. Removes all exports that have no usages by any other files in the codebase. This helps reduce unnecessary exports and maintain a cleaner API surface. @@ -883,7 +883,7 @@ def add_symbol_import( alias: str | None = None, import_type: ImportType = ImportType.UNKNOWN, is_type_import: bool = False, - ): + ) -> Import | None: """Adds an import to a file for a given symbol. This method adds an import statement to the file for a specified symbol. If an import for the @@ -896,7 +896,7 @@ def add_symbol_import( is_type_import (bool): Whether this is a type-only import. Defaults to False. Returns: - Import: The created or existing import for the symbol. + Import | None: The existing import for the symbol or None if it was added. """ imports = self.imports match = next((x for x in imports if x.imported_symbol == symbol), None) @@ -954,7 +954,7 @@ def add_symbol_from_source(self, source: str) -> None: self.insert_after("\n" + source) @writer - def add_symbol(self, symbol: Symbol, should_export: bool = True): + def add_symbol(self, symbol: Symbol, should_export: bool = True) -> Symbol | None: """Adds `symbol` to the file. Adds the given symbol to the file, optionally exporting it if applicable. If the symbol already exists in the file, returns the existing symbol. @@ -964,7 +964,7 @@ def add_symbol(self, symbol: Symbol, should_export: bool = True): should_export (bool, optional): Whether to export the symbol. Defaults to True. Returns: - Symbol: The added symbol, or the existing symbol if it already exists in the file. + Symbol | None: The existing symbol if it already exists in the file or None if it was added. Raises: ValueError: If the symbol type cannot be added to this file type. diff --git a/src/codegen/sdk/core/function.py b/src/codegen/sdk/core/function.py index a1151b405..349b4d705 100644 --- a/src/codegen/sdk/core/function.py +++ b/src/codegen/sdk/core/function.py @@ -281,7 +281,7 @@ def rename_local_variable(self, old_var_name: str, new_var_name: str, fuzzy_matc match.rename(new_name) @writer - def insert_statements(self, lines: str, index: int = 0): + def insert_statements(self, lines: str, index: int = 0) -> None: """Inserts lines of code into the function body at the specified index. Adds the provided lines as statements within the function's body at the given position. If index is 0, the lines will be prepended at the start of the function body. @@ -290,6 +290,9 @@ def insert_statements(self, lines: str, index: int = 0): lines (str): The code lines to insert into the function body. index (int, optional): The position in the function body where the lines should be inserted. Defaults to 0. + Returns: + None + Raises: ValueError: If the provided index is out of range for the function's statements. """ diff --git a/src/codegen/sdk/core/interfaces/unwrappable.py b/src/codegen/sdk/core/interfaces/unwrappable.py index 7fdee5157..341e3352f 100644 --- a/src/codegen/sdk/core/interfaces/unwrappable.py +++ b/src/codegen/sdk/core/interfaces/unwrappable.py @@ -17,7 +17,7 @@ class Unwrappable(Expression[Parent], Generic[Parent]): """ @abstractmethod - def unwrap(self, node: Expression | None = None): + def unwrap(self, node: Expression | None = None) -> None: """Unwrap this expression, removing parenthesis and other syntax elements while maintaining the function of the code. Args: diff --git a/src/codegen/sdk/core/interfaces/usable.py b/src/codegen/sdk/core/interfaces/usable.py index 6292fbbfb..58707f0cc 100644 --- a/src/codegen/sdk/core/interfaces/usable.py +++ b/src/codegen/sdk/core/interfaces/usable.py @@ -7,6 +7,7 @@ from codegen.sdk.core.dataclasses.usage import Usage, UsageType from codegen.sdk.core.interfaces.editable import Editable from codegen.sdk.core.interfaces.importable import Importable +from codegen.sdk.core.node_id_factory import NodeId from codegen.sdk.enums import EdgeType from codegen.shared.decorators.docs import apidoc @@ -73,7 +74,7 @@ def usages(self, usage_types: UsageType | None = None) -> list[Usage]: usages_to_return.append(usage) return sorted(dict.fromkeys(usages_to_return), key=lambda x: x.match.ts_node.start_byte if x.match else x.usage_symbol.ts_node.start_byte, reverse=True) - def rename(self, new_name: str, priority: int = 0): + def rename(self, new_name: str, priority: int = 0) -> tuple[NodeId, NodeId]: """Renames a symbol and updates all its references in the codebase. Args: diff --git a/src/codegen/sdk/core/statements/for_loop_statement.py b/src/codegen/sdk/core/statements/for_loop_statement.py index 63ab3d576..643d23f20 100644 --- a/src/codegen/sdk/core/statements/for_loop_statement.py +++ b/src/codegen/sdk/core/statements/for_loop_statement.py @@ -3,6 +3,7 @@ from abc import ABC from typing import TYPE_CHECKING, Generic, Self, TypeVar +from codegen.sdk.core.autocommit import reader from codegen.sdk.core.expressions import Expression from codegen.sdk.core.import_resolution import Import, WildcardImport from codegen.sdk.core.interfaces.chainable import Chainable @@ -11,7 +12,7 @@ from codegen.sdk.core.statements.statement import StatementType from codegen.sdk.core.symbol import Symbol from codegen.sdk.core.symbol_groups.collection import Collection -from codegen.shared.decorators.docs import apidoc +from codegen.shared.decorators.docs import apidoc, noapidoc if TYPE_CHECKING: from codegen.sdk.core.detached_symbols.code_block import CodeBlock @@ -32,6 +33,8 @@ class ForLoopStatement(BlockStatement[Parent], HasBlock, ABC, Generic[Parent]): item: Expression[Self] | None = None iterable: Expression[Self] + @noapidoc + @reader def resolve_name(self, name: str, start_byte: int | None = None) -> Symbol | Import | WildcardImport | None: if self.item and isinstance(self.iterable, Chainable): if start_byte is None or start_byte > self.iterable.end_byte: diff --git a/src/codegen/sdk/core/symbol.py b/src/codegen/sdk/core/symbol.py index c358f8a7a..b4761ecc3 100644 --- a/src/codegen/sdk/core/symbol.py +++ b/src/codegen/sdk/core/symbol.py @@ -382,7 +382,7 @@ def is_top_level(self) -> bool: return False @writer - def add_keyword(self, keyword: str): + def add_keyword(self, keyword: str) -> None: """Insert a keyword in the appropriate place before this symbol if it doesn't already exist. This method adds a keyword (e.g., 'public', 'async', 'static') in the syntactically appropriate diff --git a/src/codegen/sdk/typescript/detached_symbols/jsx/expression.py b/src/codegen/sdk/typescript/detached_symbols/jsx/expression.py index 4ea3d9d88..11b0bcfa3 100644 --- a/src/codegen/sdk/typescript/detached_symbols/jsx/expression.py +++ b/src/codegen/sdk/typescript/detached_symbols/jsx/expression.py @@ -55,7 +55,7 @@ def reduce_condition(self, bool_condition: bool, node: Editable) -> None: @writer @override - def unwrap(self, node: Expression | None = None): + def unwrap(self, node: Expression | None = None) -> None: """Removes the brackets from a JSX expression. diff --git a/src/codegen/sdk/typescript/file.py b/src/codegen/sdk/typescript/file.py index 4f48e0212..1c35299a9 100644 --- a/src/codegen/sdk/typescript/file.py +++ b/src/codegen/sdk/typescript/file.py @@ -398,7 +398,7 @@ def valid_import_names(self) -> dict[str, Symbol | TSImport]: #################################################################################################################### @mover - def update_filepath(self, new_filepath: str): + def update_filepath(self, new_filepath: str) -> None: """Updates the file path of the current file and all associated imports. Renames the current file to a new file path and updates all imports that reference this file to point to the new location. diff --git a/src/codegen/sdk/typescript/function.py b/src/codegen/sdk/typescript/function.py index d95f92a85..f7f164551 100644 --- a/src/codegen/sdk/typescript/function.py +++ b/src/codegen/sdk/typescript/function.py @@ -354,6 +354,18 @@ def arrow_to_named(self, name: str | None = None) -> None: @noapidoc @reader def resolve_name(self, name: str, start_byte: int | None = None) -> Symbol | Import | WildcardImport | None: + """Resolves the name of a symbol in the function. + + This method resolves the name of a symbol in the function. If the name is "this", it returns the parent class. + Otherwise, it calls the superclass method to resolve the name. + + Args: + name (str): The name of the symbol to resolve. + start_byte (int | None): The start byte of the symbol to resolve. + + Returns: + Symbol | Import | WildcardImport | None: The resolved symbol, import, or wildcard import, or None if not found. + """ if self.is_method: if name == "this": return self.parent_class From 0fe014eaec6c004dab194a53c71844c32114cbcf Mon Sep 17 00:00:00 2001 From: jemeza-codegen Date: Fri, 24 Jan 2025 16:49:44 -0800 Subject: [PATCH 2/7] docs have proper gh link --- docs/api-reference/core/Argument.mdx | 40 ++++---- docs/api-reference/core/Assignment.mdx | 56 +++++------ .../core/AssignmentStatement.mdx | 32 +++---- docs/api-reference/core/Attribute.mdx | 42 ++++---- docs/api-reference/core/AwaitExpression.mdx | 34 +++---- docs/api-reference/core/BinaryExpression.mdx | 30 +++--- docs/api-reference/core/BlockStatement.mdx | 34 +++---- docs/api-reference/core/Boolean.mdx | 30 +++--- docs/api-reference/core/Callable.mdx | 46 ++++----- docs/api-reference/core/CatchStatement.mdx | 34 +++---- docs/api-reference/core/ChainedAttribute.mdx | 30 +++--- docs/api-reference/core/Class.mdx | 84 ++++++++-------- docs/api-reference/core/CodeBlock.mdx | 50 +++++----- docs/api-reference/core/Codebase.mdx | 50 +++++----- docs/api-reference/core/Comment.mdx | 32 +++---- docs/api-reference/core/CommentGroup.mdx | 32 +++---- .../core/ComparisonExpression.mdx | 30 +++--- docs/api-reference/core/Decorator.mdx | 36 +++---- docs/api-reference/core/Dict.mdx | 30 +++--- docs/api-reference/core/Directory.mdx | 34 +++---- docs/api-reference/core/Editable.mdx | 30 +++--- docs/api-reference/core/Export.mdx | 48 +++++----- docs/api-reference/core/ExportStatement.mdx | 30 +++--- docs/api-reference/core/Exportable.mdx | 42 ++++---- docs/api-reference/core/Expression.mdx | 30 +++--- docs/api-reference/core/ExpressionGroup.mdx | 30 +++--- .../core/ExpressionStatement.mdx | 34 +++---- docs/api-reference/core/ExternalModule.mdx | 50 +++++----- docs/api-reference/core/File.mdx | 36 +++---- docs/api-reference/core/FlagKwargs.mdx | 5 +- docs/api-reference/core/ForLoopStatement.mdx | 34 +++---- docs/api-reference/core/Function.mdx | 72 +++++++------- docs/api-reference/core/FunctionCall.mdx | 48 +++++----- docs/api-reference/core/GenericType.mdx | 36 +++---- docs/api-reference/core/HasBlock.mdx | 34 +++---- docs/api-reference/core/HasName.mdx | 8 +- docs/api-reference/core/HasValue.mdx | 4 +- docs/api-reference/core/IfBlockStatement.mdx | 32 +++---- docs/api-reference/core/Import.mdx | 54 +++++------ docs/api-reference/core/ImportStatement.mdx | 30 +++--- docs/api-reference/core/Importable.mdx | 36 +++---- docs/api-reference/core/List.mdx | 34 +++---- docs/api-reference/core/MessageType.mdx | 2 +- docs/api-reference/core/MultiExpression.mdx | 30 +++--- .../core/MultiLineCollection.mdx | 34 +++---- docs/api-reference/core/Name.mdx | 30 +++--- docs/api-reference/core/NamedType.mdx | 36 +++---- docs/api-reference/core/NoneType.mdx | 30 +++--- docs/api-reference/core/Number.mdx | 30 +++--- docs/api-reference/core/Pair.mdx | 32 +++---- docs/api-reference/core/Parameter.mdx | 44 ++++----- .../core/ParenthesizedExpression.mdx | 36 +++---- docs/api-reference/core/Placeholder.mdx | 6 +- docs/api-reference/core/PlaceholderType.mdx | 30 +++--- docs/api-reference/core/RaiseStatement.mdx | 32 +++---- docs/api-reference/core/ReturnStatement.mdx | 32 +++---- docs/api-reference/core/SourceFile.mdx | 74 +++++++------- docs/api-reference/core/Span.mdx | 2 +- docs/api-reference/core/Statement.mdx | 30 +++--- docs/api-reference/core/StatementType.mdx | 2 +- docs/api-reference/core/String.mdx | 30 +++--- docs/api-reference/core/StubPlaceholder.mdx | 6 +- .../core/SubscriptExpression.mdx | 30 +++--- docs/api-reference/core/SwitchCase.mdx | 34 +++---- docs/api-reference/core/SwitchStatement.mdx | 30 +++--- docs/api-reference/core/Symbol.mdx | 50 +++++----- docs/api-reference/core/SymbolGroup.mdx | 30 +++--- docs/api-reference/core/SymbolStatement.mdx | 30 +++--- docs/api-reference/core/TernaryExpression.mdx | 30 +++--- docs/api-reference/core/TryCatchStatement.mdx | 34 +++---- docs/api-reference/core/Tuple.mdx | 34 +++---- docs/api-reference/core/TupleType.mdx | 34 +++---- docs/api-reference/core/Type.mdx | 30 +++--- docs/api-reference/core/TypeAlias.mdx | 58 +++++------ docs/api-reference/core/TypePlaceholder.mdx | 6 +- docs/api-reference/core/Typeable.mdx | 30 +++--- docs/api-reference/core/UnaryExpression.mdx | 30 +++--- docs/api-reference/core/UnionType.mdx | 34 +++---- docs/api-reference/core/Unpack.mdx | 36 +++---- docs/api-reference/core/Unwrappable.mdx | 32 +++---- docs/api-reference/core/Usable.mdx | 40 ++++---- docs/api-reference/core/Usage.mdx | 2 +- docs/api-reference/core/UsageKind.mdx | 2 +- docs/api-reference/core/UsageType.mdx | 2 +- docs/api-reference/core/Value.mdx | 30 +++--- docs/api-reference/core/WhileStatement.mdx | 34 +++---- docs/api-reference/core/WithStatement.mdx | 34 +++---- docs/api-reference/python/PyAssignment.mdx | 60 ++++++------ .../python/PyAssignmentStatement.mdx | 34 +++---- docs/api-reference/python/PyAttribute.mdx | 46 ++++----- .../api-reference/python/PyBlockStatement.mdx | 34 +++---- .../api-reference/python/PyBreakStatement.mdx | 30 +++--- .../api-reference/python/PyCatchStatement.mdx | 34 +++---- .../python/PyChainedAttribute.mdx | 30 +++--- docs/api-reference/python/PyClass.mdx | 86 ++++++++--------- docs/api-reference/python/PyCodeBlock.mdx | 52 +++++----- docs/api-reference/python/PyComment.mdx | 36 +++---- docs/api-reference/python/PyCommentGroup.mdx | 34 +++---- docs/api-reference/python/PyCommentType.mdx | 2 +- .../python/PyConditionalExpression.mdx | 30 +++--- docs/api-reference/python/PyDecorator.mdx | 36 +++---- docs/api-reference/python/PyFile.mdx | 78 +++++++-------- .../python/PyForLoopStatement.mdx | 34 +++---- docs/api-reference/python/PyFunction.mdx | 74 +++++++------- docs/api-reference/python/PyGenericType.mdx | 36 +++---- docs/api-reference/python/PyHasBlock.mdx | 34 +++---- .../python/PyIfBlockStatement.mdx | 32 +++---- docs/api-reference/python/PyImport.mdx | 56 +++++------ .../python/PyImportStatement.mdx | 30 +++--- docs/api-reference/python/PyMatchCase.mdx | 34 +++---- .../api-reference/python/PyMatchStatement.mdx | 30 +++--- docs/api-reference/python/PyNamedType.mdx | 36 +++---- docs/api-reference/python/PyParameter.mdx | 46 ++++----- docs/api-reference/python/PyPassStatement.mdx | 30 +++--- .../python/PyReturnTypePlaceholder.mdx | 6 +- docs/api-reference/python/PyString.mdx | 30 +++--- docs/api-reference/python/PySymbol.mdx | 52 +++++----- .../python/PyTryCatchStatement.mdx | 34 +++---- docs/api-reference/python/PyUnionType.mdx | 34 +++---- .../api-reference/python/PyWhileStatement.mdx | 34 +++---- docs/api-reference/typescript/JSXElement.mdx | 42 ++++---- .../typescript/JSXExpression.mdx | 32 +++---- docs/api-reference/typescript/JSXProp.mdx | 38 ++++---- docs/api-reference/typescript/TSArrayType.mdx | 36 +++---- .../api-reference/typescript/TSAssignment.mdx | 60 ++++++------ .../typescript/TSAssignmentStatement.mdx | 32 +++---- docs/api-reference/typescript/TSAttribute.mdx | 44 ++++----- .../typescript/TSBlockStatement.mdx | 36 +++---- .../typescript/TSCatchStatement.mdx | 36 +++---- .../typescript/TSChainedAttribute.mdx | 30 +++--- docs/api-reference/typescript/TSClass.mdx | 92 +++++++++--------- docs/api-reference/typescript/TSCodeBlock.mdx | 50 +++++----- docs/api-reference/typescript/TSComment.mdx | 36 +++---- .../typescript/TSCommentGroup.mdx | 32 +++---- .../typescript/TSCommentType.mdx | 2 +- .../typescript/TSConditionalType.mdx | 30 +++--- docs/api-reference/typescript/TSConfig.mdx | 8 +- docs/api-reference/typescript/TSDecorator.mdx | 36 +++---- docs/api-reference/typescript/TSDict.mdx | 30 +++--- docs/api-reference/typescript/TSEnum.mdx | 60 ++++++------ docs/api-reference/typescript/TSExport.mdx | 66 ++++++------- .../typescript/TSExpressionType.mdx | 36 +++---- docs/api-reference/typescript/TSFile.mdx | 96 +++++++++---------- .../typescript/TSForLoopStatement.mdx | 36 +++---- docs/api-reference/typescript/TSFunction.mdx | 82 ++++++++-------- .../typescript/TSFunctionType.mdx | 32 +++---- .../typescript/TSGenericType.mdx | 36 +++---- docs/api-reference/typescript/TSHasBlock.mdx | 36 +++---- .../typescript/TSIfBlockStatement.mdx | 32 +++---- docs/api-reference/typescript/TSImport.mdx | 62 ++++++------ .../typescript/TSImportStatement.mdx | 30 +++--- docs/api-reference/typescript/TSInterface.mdx | 64 ++++++------- .../typescript/TSLabeledStatement.mdx | 36 +++---- .../api-reference/typescript/TSLookupType.mdx | 30 +++--- docs/api-reference/typescript/TSNamedType.mdx | 36 +++---- docs/api-reference/typescript/TSNamespace.mdx | 74 +++++++------- .../api-reference/typescript/TSObjectType.mdx | 30 +++--- docs/api-reference/typescript/TSPair.mdx | 32 +++---- docs/api-reference/typescript/TSParameter.mdx | 46 ++++----- docs/api-reference/typescript/TSQueryType.mdx | 30 +++--- .../typescript/TSReadonlyType.mdx | 30 +++--- .../typescript/TSReturnTypePlaceholder.mdx | 6 +- docs/api-reference/typescript/TSString.mdx | 30 +++--- .../api-reference/typescript/TSSwitchCase.mdx | 36 +++---- .../typescript/TSSwitchStatement.mdx | 30 +++--- docs/api-reference/typescript/TSSymbol.mdx | 52 +++++----- .../typescript/TSTernaryExpression.mdx | 30 +++--- .../typescript/TSTryCatchStatement.mdx | 36 +++---- docs/api-reference/typescript/TSTypeAlias.mdx | 62 ++++++------ .../typescript/TSUndefinedType.mdx | 30 +++--- docs/api-reference/typescript/TSUnionType.mdx | 34 +++---- .../typescript/TSWhileStatement.mdx | 36 +++---- 172 files changed, 3103 insertions(+), 3104 deletions(-) diff --git a/docs/api-reference/core/Argument.mdx b/docs/api-reference/core/Argument.mdx index 4a7f74900..a6bedf024 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) @@ -111,7 +111,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 +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[ Argument ] } description=""/> @@ -225,7 +225,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -233,7 +233,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 +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=""/> @@ -354,7 +354,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -362,7 +362,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -147,7 +147,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 +189,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=""/> @@ -278,7 +278,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -286,7 +286,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before 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=""/> @@ -405,7 +405,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -413,7 +413,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=""/> @@ -450,7 +450,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -128,7 +128,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 +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[ AssignmentStatement ] } description=""/> @@ -225,7 +225,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 +338,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -346,7 +346,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -354,7 +354,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -148,7 +148,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 +156,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=""/> @@ -245,7 +245,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -253,7 +253,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 +366,7 @@ Check if this node is contained another node of 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 +374,7 @@ Find the 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 +382,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ AwaitExpression ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -395,7 +395,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -105,7 +105,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 +113,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 +202,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 +315,7 @@ Check if this node is contained another node of 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 +323,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) @@ -121,7 +121,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 +152,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 +241,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 +354,7 @@ Check if this node is contained another node of 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 +362,7 @@ Find the 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 +370,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) @@ -90,7 +90,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 +98,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 +187,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 +300,7 @@ Check if this node is contained another node of 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 +308,7 @@ Find the 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 +316,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) @@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -123,7 +123,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Callable ] } description=""/> @@ -212,7 +212,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -220,7 +220,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 +384,7 @@ Check if this node is contained another node of 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 +392,7 @@ Find the 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 +400,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -130,7 +130,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 +161,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 +250,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 +363,7 @@ Check if this node is contained another node of 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 +371,7 @@ Find the 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 +379,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) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `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 +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=""/> @@ -313,7 +313,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Symbol](/api-reference/core/Symbol), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -176,7 +176,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 +298,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 +410,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -452,7 +452,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_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 +679,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 +745,7 @@ Find the 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 +753,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -137,7 +137,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 +145,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 +234,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 +442,7 @@ Check if this node is contained another node of 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 +450,7 @@ Find the 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 +458,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 +594,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 @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ai Generates a response from the AI based on the provided prompt, target, and context. - + checkout Checks out a git branch or commit and syncs the codebase graph to the new state. - + commit Commits all staged changes to the codebase graph and synchronizes the graph with the filesystem if specified. - + create_directory Creates a directory at the specified path. - + create_file Creates a new file in the codebase with specified content. - + 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 +244,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. - + 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,7 +545,7 @@ Resets the codebase by ### set_ai_key Sets the OpenAI key for the current Codebase instance. - + None } description=""/> @@ -553,7 +553,7 @@ Sets the OpenAI key for the current Codebase instance. ### set_session_options Sets the Session options for the current codebase. - + None } description=""/> @@ -561,7 +561,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) @@ -108,7 +108,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 +116,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Comment ] } description=""/> @@ -222,7 +222,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 +335,7 @@ Check if this node is contained another node of 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 +343,7 @@ Find the 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 +351,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) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ CommentGroup ] } description=""/> @@ -213,7 +213,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -326,7 +326,7 @@ Check if this node is contained another node of 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 +334,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -342,7 +342,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [BinaryExpression](/api-reference/core/BinaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -108,7 +108,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 +116,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 +205,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 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a binary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Decorator ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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 +192,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 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes @@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_file Add a file to the directory. - + None } description=""/> @@ -83,7 +83,7 @@ Add a file to the directory. ### add_subdirectory Add a subdirectory to the directory. - + None } description=""/> @@ -91,7 +91,7 @@ Add a subdirectory to the directory. ### get_class Get a class by name in the directory and its subdirectories. - + Class | None } description=""/> @@ -99,7 +99,7 @@ Get a class by name in the directory and its subdirectories. ### get_file Get a file by its name relative to the directory. - + File | None } description=""/> @@ -107,7 +107,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,7 +115,7 @@ 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=""/> @@ -123,7 +123,7 @@ Get a global variable by name in the directory and its subdirectories. ### get_import_statement Get an import statement by name in the directory and its subdirectories. - + ImportStatement | None } description=""/> @@ -131,7 +131,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 +139,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 +147,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 +155,7 @@ Remove the directory and all its files and subdirectories. ### remove_file Remove a file from the directory. - + None } description=""/> @@ -163,7 +163,7 @@ Remove a file from the directory. ### remove_file_by_path Remove a file from the directory by its path. - + None } description=""/> @@ -171,7 +171,7 @@ Remove a file from the directory by its path. ### remove_subdirectory Remove a subdirectory from the directory. - + None } description=""/> @@ -179,7 +179,7 @@ Remove a subdirectory from the directory. ### remove_subdirectory_by_path Remove a subdirectory from the directory by its path. - + None } description=""/> @@ -187,7 +187,7 @@ Remove a subdirectory from the directory by its path. ### rename Rename the directory. - + None } description=""/> @@ -195,7 +195,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 fbb7da55c..5ec1cbbe6 100644 --- a/docs/api-reference/core/Editable.mdx +++ b/docs/api-reference/core/Editable.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ## Attributes @@ -85,7 +85,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 +93,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 +182,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 +295,7 @@ Check if this node is contained another node of 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 +303,7 @@ Find the 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 +311,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) @@ -128,7 +128,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 +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[ Export ] } description=""/> @@ -225,7 +225,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -268,7 +268,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 +381,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 +389,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 +397,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 +405,7 @@ Check if this node is contained another node of 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 +413,7 @@ Find the 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 +421,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -117,7 +117,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 +125,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 +214,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 +327,7 @@ Check if this node is contained another node of 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 +335,7 @@ Find the 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 +343,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) @@ -117,7 +117,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 +125,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 +214,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for a symbol. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -257,7 +257,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before 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 +370,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -378,7 +378,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -386,7 +386,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Expression ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ ExpressionGroup ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -309,7 +309,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -317,7 +317,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -325,7 +325,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -123,7 +123,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -131,7 +131,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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 +220,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 +333,7 @@ Check if this node is contained another node of 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 +341,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -349,7 +349,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -427,7 +427,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Callable](/api-reference/core/Callable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -117,7 +117,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 +125,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 +214,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_import Creates an ExternalModule instance from an Import instance. - + get_import_string Returns the import string used to import this module. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -274,7 +274,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 +438,7 @@ Check if this node is contained another node of 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 +446,7 @@ Find the 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 +454,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -125,7 +125,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=""/> @@ -133,7 +133,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[ File ] } description=""/> @@ -222,7 +222,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 +335,7 @@ Check if this node is contained another node of 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 +343,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 +368,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -376,7 +376,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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + update_filepath Updates the file path and inbound imports of a file. - + + ## Attributes diff --git a/docs/api-reference/core/ForLoopStatement.mdx b/docs/api-reference/core/ForLoopStatement.mdx index 2805591c5..08ca24070 100644 --- a/docs/api-reference/core/ForLoopStatement.mdx +++ b/docs/api-reference/core/ForLoopStatement.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Expression](/api-reference/core/Expression), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable) @@ -134,7 +134,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 +165,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 +254,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 +367,7 @@ Check if this node is contained another node of 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 +375,7 @@ Find the 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 +383,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) @@ -198,7 +198,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 +280,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 +288,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=""/> @@ -377,7 +377,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -385,7 +385,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 +578,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 +615,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 +640,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -128,7 +128,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 +136,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 +144,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 +250,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_usage Creates a FunctionCall object from an Editable instance that represents a function call. - + get_arg_by_index Returns the Argument with the given index from the function call's argument list. - + get_arg_by_parameter_name Returns an argument by its parameter name. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -315,7 +315,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=""/> @@ -428,7 +428,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -436,7 +436,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -444,7 +444,7 @@ Reduces an editable to the following condition ### remove Removes a node and optionally its related extended nodes. - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_kwarg Set a keyword argument in a function call. - + set_name Sets the name of a code element. - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ GenericType ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ HasBlock ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -336,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=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ## Attributes @@ -29,7 +29,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -37,7 +37,7 @@ Returns the name node of the object. ### rename Sets the name of an object and updates all its usages. - + set_name Sets the name of a code element. - + + ## Attributes @@ -25,7 +25,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### set_value Sets the value of the node's value Expression. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -145,7 +145,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 +153,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 +196,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 +250,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 +363,7 @@ Check if this node is contained another node of 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 +371,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) @@ -169,7 +169,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 +177,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=""/> @@ -266,7 +266,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -274,7 +274,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 +387,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 +395,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 +403,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 +411,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 +419,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 +427,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -435,7 +435,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -443,7 +443,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +121,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 +210,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 +323,7 @@ Check if this node is contained another node of 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 +331,7 @@ Find the 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 +339,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) @@ -102,7 +102,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 +110,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=""/> @@ -199,7 +199,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -207,7 +207,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -320,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=""/> @@ -328,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=""/> @@ -336,7 +336,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -94,7 +94,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=""/> @@ -102,7 +102,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -110,7 +110,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 +164,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -195,7 +195,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -203,7 +203,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -309,7 +309,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ## Attributes diff --git a/docs/api-reference/core/MultiExpression.mdx b/docs/api-reference/core/MultiExpression.mdx index d1a6a8c16..16baeb49f 100644 --- a/docs/api-reference/core/MultiExpression.mdx +++ b/docs/api-reference/core/MultiExpression.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -92,7 +92,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 +100,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 +189,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 +302,7 @@ Check if this node is contained another node of 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 +310,7 @@ Find the 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 +318,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) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -115,7 +115,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ MultiLineCollection ] } description=""/> @@ -169,7 +169,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -200,7 +200,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -208,7 +208,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -298,7 +298,7 @@ Check if this node is contained another node of 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 +306,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -314,7 +314,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Name ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -317,7 +317,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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=""/> @@ -192,7 +192,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -200,7 +200,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 +313,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -329,7 +329,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ NoneType ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -90,7 +90,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 +98,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 +187,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 +300,7 @@ Check if this node is contained another node of 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 +308,7 @@ Find the 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 +316,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) @@ -96,7 +96,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 +104,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 +193,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 +306,7 @@ Check if this node is contained another node of 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 +314,7 @@ Find the 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 +322,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -127,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=""/> @@ -135,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[ Parameter ] } description=""/> @@ -224,7 +224,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -232,7 +232,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 +345,7 @@ Check if this node is contained another node of 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 +353,7 @@ Find the 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 +361,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -97,7 +97,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 +105,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 +194,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 +307,7 @@ Check if this node is contained another node of 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 +315,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -416,7 +416,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + unwrap Removes the parentheses from a parenthesized expression node. - + + @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Replaces the content of a placeholder node with new source code. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/PlaceholderType.mdx b/docs/api-reference/core/PlaceholderType.mdx index 95ae10dc1..ed823a215 100644 --- a/docs/api-reference/core/PlaceholderType.mdx +++ b/docs/api-reference/core/PlaceholderType.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PlaceholderType ] } description=""/> @@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -297,7 +297,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -313,7 +313,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -114,7 +114,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 +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[ RaiseStatement ] } description=""/> @@ -211,7 +211,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 +324,7 @@ Check if this node is contained another node of 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 +332,7 @@ Find the 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 +340,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -117,7 +117,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 +125,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 +214,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 +327,7 @@ Check if this node is contained another node of 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 +335,7 @@ Find the 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 +343,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Usable](/api-reference/core/Usable), [HasBlock](/api-reference/core/HasBlock), [File](/api-reference/core/File), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -190,7 +190,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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -313,7 +313,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_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 +419,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -495,7 +495,7 @@ Returns the name node of the object. ### get_symbol Gets a symbol by its name from the file. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -642,7 +642,7 @@ Check if this node is contained another node of 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 +650,7 @@ Find the 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 +658,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -666,7 +666,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -674,7 +674,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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if the file type supports adding the given symbol. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ Symbol | Class | Function | Assignment | 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"/> @@ -843,7 +843,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Renames the file and updates all imports to point to the new location. - + usages Returns a list of usages of the exportable object. - + + ## Attributes diff --git a/docs/api-reference/core/Statement.mdx b/docs/api-reference/core/Statement.mdx index 0e02f6946..e1731c449 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) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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(). - + + ## Attributes diff --git a/docs/api-reference/core/String.mdx b/docs/api-reference/core/String.mdx index 189f6947a..524a4eb69 100644 --- a/docs/api-reference/core/String.mdx +++ b/docs/api-reference/core/String.mdx @@ -16,7 +16,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) @@ -109,7 +109,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 +117,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 +206,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 +319,7 @@ Check if this node is contained another node of 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 +327,7 @@ Find the 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 +335,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 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the source code of this placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/SubscriptExpression.mdx b/docs/api-reference/core/SubscriptExpression.mdx index 2b6f19967..024ffdc3a 100644 --- a/docs/api-reference/core/SubscriptExpression.mdx +++ b/docs/api-reference/core/SubscriptExpression.mdx @@ -15,7 +15,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) @@ -101,7 +101,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 +109,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 +198,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 +311,7 @@ Check if this node is contained another node of 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 +319,7 @@ Find the 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 +327,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -130,7 +130,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 +161,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 +250,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 +363,7 @@ Check if this node is contained another node of 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 +371,7 @@ Find the 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 +379,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) @@ -117,7 +117,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 +125,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 +214,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 +327,7 @@ Check if this node is contained another node of 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 +335,7 @@ Find the 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 +343,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) @@ -119,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=""/> @@ -161,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[ Symbol ] } description=""/> @@ -250,7 +250,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -258,7 +258,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before 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 +377,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 +414,7 @@ Find the 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 +422,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Editable](/api-reference/core/Editable) @@ -97,7 +97,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 +105,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ SymbolGroup ] } description=""/> @@ -194,7 +194,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -307,7 +307,7 @@ Check if this node is contained another node of 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 +315,7 @@ Find the 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 +323,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +121,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 +210,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 +323,7 @@ Check if this node is contained another node of 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 +331,7 @@ Find the 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 +339,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) @@ -102,7 +102,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 +110,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 +199,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 +312,7 @@ Check if this node is contained another node of 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 +320,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [BlockStatement](/api-reference/core/BlockStatement), [Expression](/api-reference/core/Expression), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable) @@ -129,7 +129,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 +160,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 +249,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 +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=""/> @@ -370,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=""/> @@ -378,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(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable), [SymbolGroup](/api-reference/core/SymbolGroup) @@ -94,7 +94,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=""/> @@ -102,7 +102,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -110,7 +110,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 +164,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -195,7 +195,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -203,7 +203,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -293,7 +293,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -309,7 +309,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -101,7 +101,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 +109,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -117,7 +117,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TupleType ] } description=""/> @@ -171,7 +171,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -202,7 +202,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -210,7 +210,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,7 +300,7 @@ Check if this node is contained another node of 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 +308,7 @@ Find the 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 +316,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -89,7 +89,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 +97,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 +186,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 +299,7 @@ Check if this node is contained another node of 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 +307,7 @@ Find the 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 +315,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) @@ -149,7 +149,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 +214,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 +303,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Get attribute by name. - + Attribute | None } description=""/> @@ -311,7 +311,7 @@ Get attribute by name. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -319,7 +319,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 +438,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 +475,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -483,7 +483,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates the docstring for the current entity. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits the type annotation of a placeholder node. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/core/Typeable.mdx b/docs/api-reference/core/Typeable.mdx index 73ad7dbbc..cd1e30c1f 100644 --- a/docs/api-reference/core/Typeable.mdx +++ b/docs/api-reference/core/Typeable.mdx @@ -15,7 +15,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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 +192,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 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -321,7 +321,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -103,7 +103,7 @@ Find all ancestors of the node of the given type. Does not return itself ### 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 +192,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 +305,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a unary expression by reducing it based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -101,7 +101,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 +109,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -117,7 +117,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ UnionType ] } description=""/> @@ -171,7 +171,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -202,7 +202,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -210,7 +210,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -300,7 +300,7 @@ Check if this node is contained another node of 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 +308,7 @@ Find the 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 +316,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -97,7 +97,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 +105,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 +194,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 +307,7 @@ Check if this node is contained another node of 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 +315,7 @@ Find the 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 +323,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve Resolves the wrapper expression and returns the first concrete expression. - + Expression } description=""/> @@ -401,7 +401,7 @@ Resolves the wrapper expression and returns the first concrete expression. ### search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + unwrap Unwraps a node's content into its parent node. - + + ### Inherits from [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -89,7 +89,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 +97,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 +186,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 +299,7 @@ Check if this node is contained another node of 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 +307,7 @@ Find the 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 +315,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + unwrap Unwrap this expression, removing parenthesis and other syntax elements while maintaining the function of the code. - + None } description=""/> diff --git a/docs/api-reference/core/Usable.mdx b/docs/api-reference/core/Usable.mdx index a16806065..6c5256fba 100644 --- a/docs/api-reference/core/Usable.mdx +++ b/docs/api-reference/core/Usable.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ Usable ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ## Attributes diff --git a/docs/api-reference/core/UsageKind.mdx b/docs/api-reference/core/UsageKind.mdx index 55b1f80f7..3048ef120 100644 --- a/docs/api-reference/core/UsageKind.mdx +++ b/docs/api-reference/core/UsageKind.mdx @@ -25,7 +25,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/UsageType.mdx b/docs/api-reference/core/UsageType.mdx index 50cdd1e02..3bc3444ed 100644 --- a/docs/api-reference/core/UsageType.mdx +++ b/docs/api-reference/core/UsageType.mdx @@ -18,7 +18,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 8a1792333..d87ce0c3f 100644 --- a/docs/api-reference/core/Value.mdx +++ b/docs/api-reference/core/Value.mdx @@ -16,7 +16,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) @@ -92,7 +92,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 +100,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 +189,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 +302,7 @@ Check if this node is contained another node of 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 +310,7 @@ Find the 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 +318,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) @@ -125,7 +125,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 +156,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 +245,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 +358,7 @@ Check if this node is contained another node of 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 +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=""/> @@ -374,7 +374,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates the docstring for the current entity. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [Statement](/api-reference/core/Statement), [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -141,7 +141,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 +172,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 +261,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 +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=""/> @@ -382,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=""/> @@ -390,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(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### 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) @@ -143,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=""/> @@ -203,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[ PyAssignment ] } description=""/> @@ -292,7 +292,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. - + 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."/> @@ -370,7 +370,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=""/> @@ -489,7 +489,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -497,7 +497,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=""/> @@ -534,7 +534,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [AssignmentStatement](/api-reference/core/AssignmentStatement), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -133,7 +133,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 +141,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 +230,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 +396,7 @@ Check if this node is contained another node of 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 +404,7 @@ Find the 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 +412,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [PyAssignmentStatement](/api-reference/python/PyAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -153,7 +153,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 +161,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 +250,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### from_assignment Creates a PyAssignmentStatement instance from a TreeSitter assignment node. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -311,7 +311,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=""/> @@ -424,7 +424,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 +432,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 +440,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -448,7 +448,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -121,7 +121,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 +152,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 +241,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 +354,7 @@ Check if this node is contained another node of 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 +362,7 @@ Find the 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 +370,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [PyBlockStatement](/api-reference/python/PyBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -130,7 +130,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 +161,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 +250,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 +363,7 @@ Check if this node is contained another node of 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 +371,7 @@ Find the 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 +379,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [ChainedAttribute](/api-reference/core/ChainedAttribute), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -101,7 +101,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 +109,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 +198,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 +311,7 @@ Check if this node is contained another node of 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 +319,7 @@ Find the 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 +327,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) @@ -180,7 +180,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds an attribute to a class from raw source code, placing it in a specific location - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_source Adds source code to the class definition. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -320,7 +320,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[ PyClass ] } description=""/> @@ -432,7 +432,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + get_import_string Generates an import string for a Python symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -509,7 +509,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_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=""/> @@ -736,7 +736,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=""/> @@ -802,7 +802,7 @@ Find the 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 +810,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [CodeBlock](/api-reference/core/CodeBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -137,7 +137,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 +145,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 +234,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_assignments Returns a list of assignments with the specified variable name. - + get_attributes Returns attributes from the code block, with the option to include or exclude private - + get_comment Gets the first comment statement containing a specific text string. - + get_local_var_assignment Returns the first code statement that assigns a local variable with the specified name. - + get_local_var_assignments Returns all instances of local variable assignments that match the specified variable - + get_statements Returns all statements of a given type up to the specified block level. - + get_variable_usages Returns all instances of variable usages in a code block. - + get_with_statements Gets with statements at a specific block level. - + indent Adjusts the indentation level of the entire code block. - + insert_after Inserts source code at the bottom of the code block. - + insert_before Inserts new source code at the top of the code block. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -459,7 +459,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -467,7 +467,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -475,7 +475,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 +611,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) @@ -116,7 +116,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 +124,7 @@ Find all ancestors of the node of the given type. Does not return itself ### clean_comment Cleans a comment block by removing comment symbols, leading/trailing whitespace, and standardizing indentation. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyComment ] } description=""/> @@ -247,7 +247,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 +395,7 @@ Check if this node is contained another node of 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 +403,7 @@ Find the 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 +411,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) @@ -108,7 +108,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 +116,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyCommentGroup ] } description=""/> @@ -222,7 +222,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,7 +335,7 @@ Check if this node is contained another node of 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 +343,7 @@ Find the 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 +351,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + to_google_docstring Convert a comment group into a Google-style docstring. - + + ## Attributes diff --git a/docs/api-reference/python/PyConditionalExpression.mdx b/docs/api-reference/python/PyConditionalExpression.mdx index 6861ab3b0..1578a20ab 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) @@ -102,7 +102,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 +110,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 +199,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 +312,7 @@ Check if this node is contained another node of 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 +320,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) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyDecorator ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [SourceFile](/api-reference/core/SourceFile), [HasBlock](/api-reference/core/HasBlock), [Usable](/api-reference/core/Usable), [File](/api-reference/core/File), [Expression](/api-reference/core/Expression), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [HasName](/api-reference/core/HasName) @@ -191,7 +191,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. - + 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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -314,7 +314,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_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 +420,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_extensions Returns the file extensions associated with Python files. - + list[str] } description="A list containing '.py' as the only Python file extension."/> @@ -445,7 +445,7 @@ Returns the file extensions associated with Python files. ### get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_import_insert_index Determines the index position where a new import statement should be inserted in a Python file. - + get_import_string Generates an import string for a symbol. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -556,7 +556,7 @@ Returns the name node of the object. ### get_symbol Gets a symbol by its name from the file. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -703,7 +703,7 @@ Check if this node is contained another node of 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 +711,7 @@ Find the 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 +719,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -727,7 +727,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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + set_name Sets the name of a code element. - + symbol_can_be_added Checks if a Python symbol can be added to this Python source file. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ 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"/> @@ -914,7 +914,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Renames the file and updates all imports to point to the new location. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [ForLoopStatement](/api-reference/core/ForLoopStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -134,7 +134,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 +165,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 +254,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 +367,7 @@ Check if this node is contained another node of 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 +375,7 @@ Find the 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 +383,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [PySymbol](/api-reference/python/PySymbol), [Function](/api-reference/core/Function), [HasBlock](/api-reference/core/HasBlock), [Symbol](/api-reference/core/Symbol), [Callable](/api-reference/core/Callable), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -210,7 +210,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 +310,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 +318,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 +407,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. - + 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."/> @@ -450,7 +450,7 @@ Returns the name node of the object. ### get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + insert_statements Inserts lines of code into the function body at the specified index. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -643,7 +643,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=""/> @@ -680,7 +680,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 +705,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_docstring Sets or updates a docstring for a Python function or class. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets or modifies the return type annotation of a function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyNamedType](/api-reference/python/PyNamedType), [GenericType](/api-reference/core/GenericType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `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=""/> @@ -200,7 +200,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -208,7 +208,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=""/> @@ -321,7 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_decorator Adds a decorator to a function or method. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -134,7 +134,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyHasBlock ] } description=""/> @@ -223,7 +223,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -336,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=""/> @@ -344,7 +344,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -352,7 +352,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -141,7 +141,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 +149,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."/> @@ -192,7 +192,7 @@ Returns all elif blocks within the if block. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyIfBlockStatement ] } description=""/> @@ -246,7 +246,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 +359,7 @@ Check if this node is contained another node of 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 +367,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) @@ -155,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=""/> @@ -163,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[ PyImport ] } description=""/> @@ -252,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 import statement. - + 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."/> @@ -295,7 +295,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."/> @@ -408,7 +408,7 @@ Returns True if this import is aliased. ### is_module_import Determines if the import is a module-level or wildcard import. - + bool } description="True if the import is a module-level or wildcard import, False otherwise."/> @@ -416,7 +416,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 +424,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 +432,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 +440,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 +448,7 @@ Check if this node is contained another node of 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 +456,7 @@ Find the 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 +464,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -108,7 +108,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 +116,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 +205,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 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -334,7 +334,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) @@ -125,7 +125,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 +156,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 +245,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 +358,7 @@ Check if this node is contained another node of 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 +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=""/> @@ -374,7 +374,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +121,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 +210,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 +323,7 @@ Check if this node is contained another node of 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 +331,7 @@ Find the 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 +339,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -100,7 +100,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 +108,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=""/> @@ -197,7 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -205,7 +205,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=""/> @@ -318,7 +318,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -326,7 +326,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -334,7 +334,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -127,7 +127,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 +152,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=""/> @@ -241,7 +241,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -249,7 +249,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=""/> @@ -362,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=""/> @@ -370,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=""/> @@ -378,7 +378,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation of a parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [Placeholder](/api-reference/core/Placeholder) @@ -23,7 +23,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Edits or creates a return type annotation for a method or function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/python/PyString.mdx b/docs/api-reference/python/PyString.mdx index 156426352..4509206e3 100644 --- a/docs/api-reference/python/PyString.mdx +++ b/docs/api-reference/python/PyString.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [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) @@ -120,7 +120,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 +180,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 +269,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. - + 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."/> @@ -312,7 +312,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=""/> @@ -431,7 +431,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=""/> @@ -468,7 +468,7 @@ Find the 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 +476,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment for the Python symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [PyBlockStatement](/api-reference/python/PyBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [PyHasBlock](/api-reference/python/PyHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -133,7 +133,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 +164,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 +253,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 +366,7 @@ Check if this node is contained another node of 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 +374,7 @@ Find the 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 +382,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [UnionType](/api-reference/core/UnionType), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [SymbolGroup](/api-reference/core/SymbolGroup), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -119,7 +119,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ PyUnionType ] } description=""/> @@ -173,7 +173,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -204,7 +204,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -212,7 +212,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,7 +302,7 @@ Check if this node is contained another node of 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 +310,7 @@ Find the 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 +318,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [PyHasBlock](/api-reference/python/PyHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -133,7 +133,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 +164,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 +253,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 +366,7 @@ Check if this node is contained another node of 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 +374,7 @@ Find the 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 +382,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a Python function or class. - + + ### Inherits from [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -111,7 +111,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 +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[ JSXElement ] } description=""/> @@ -231,7 +231,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -239,7 +239,7 @@ Returns the name node of the object. ### get_prop Returns the JSXProp with the given name from the JSXElement. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -369,7 +369,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -377,7 +377,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -385,7 +385,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a JSXElement by modifying both opening and closing tags. - + wrap Wraps the current JSXElement with the provided opening and closing tags, properly handling indentation. - + + ### Inherits from [Unwrappable](/api-reference/core/Unwrappable), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -91,7 +91,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -99,7 +99,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ JSXExpression ] } description=""/> @@ -188,7 +188,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -301,7 +301,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### 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 800187bdf..d864ec12e 100644 --- a/docs/api-reference/typescript/JSXProp.mdx +++ b/docs/api-reference/typescript/JSXProp.mdx @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `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=""/> @@ -200,7 +200,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -208,7 +208,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after a JSX prop in a TypeScript/JSX file. - + insert_before Insert a new source code string before a JSX prop in a React component. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -321,7 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSNamedType](/api-reference/typescript/TSNamedType), [NamedType](/api-reference/core/NamedType), [HasName](/api-reference/core/HasName), [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -98,7 +98,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 +106,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=""/> @@ -195,7 +195,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -203,7 +203,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=""/> @@ -316,7 +316,7 @@ Check if this node is contained another node of 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 +324,7 @@ Find the 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 +332,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [TSSymbol](/api-reference/typescript/TSSymbol), [Assignment](/api-reference/core/Assignment), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -172,7 +172,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 +232,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 +321,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. - + 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."/> @@ -399,7 +399,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=""/> @@ -518,7 +518,7 @@ Check if this node is contained another node of the given class ### local_usages Retrieves all usages of the assigned variable within its code block scope. - + list[ Editable [ Statement ]] } description="A sorted list of statement nodes where the variable is used."/> @@ -526,7 +526,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=""/> @@ -563,7 +563,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment for an assignment node. - + set_name Sets the name of a code element. - + set_type_annotation Adds or updates a type annotation for the current assignment. - + set_value Sets the value of an assignment expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [AssignmentStatement](/api-reference/core/AssignmentStatement), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -133,7 +133,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 +141,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 +230,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 +343,7 @@ Check if this node is contained another node of 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 +351,7 @@ Find the 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 +359,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [TSAssignmentStatement](/api-reference/typescript/TSAssignmentStatement), [Attribute](/api-reference/core/Attribute), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Usable](/api-reference/core/Usable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -153,7 +153,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 +161,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=""/> @@ -250,7 +250,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -258,7 +258,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -371,7 +371,7 @@ Check if this node is contained another node of the given class ### local_usages Returns local usages of a TypeScript attribute within its code block. - + parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -396,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=""/> @@ -404,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(). - + set_name Sets the name of a code element. - + set_value Sets the value of a node's assignment. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -125,7 +125,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 +156,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 +245,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 +375,7 @@ Check if this node is contained another node of 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 +383,7 @@ Find the 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 +391,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [CatchStatement](/api-reference/core/CatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -134,7 +134,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 +165,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 +254,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 +384,7 @@ Check if this node is contained another node of 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 +392,7 @@ Find the 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 +400,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) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [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) @@ -217,7 +217,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### add_attribute Adds an attribute to a class from another class. - + add_attribute_from_source Adds a class attribute from source code to a TypeScript/JavaScript class. - + add_comment Adds a new comment to the symbol. - + add_decorator Adds a decorator to a function or method. - + add_keyword Insert a keyword in the appropriate place before this symbol if it doesn't already exist. - + add_source Adds source code to a class body. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -357,7 +357,7 @@ Find all ancestors of the node of the given type. Does not return itself ### attributes Retrieves all attributes from this Class including those from its superclasses up to a - + class_component_to_function_component Converts a class component to a function component. - + None } description=""/> @@ -388,7 +388,7 @@ Converts a class component to a function component. ### convert_props_to_interface Converts React component props to TypeScript interfaces. - + None } description=""/> @@ -396,7 +396,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 +485,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns a specific attribute by name. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_method Returns a specific method by name from the class or any of its superclasses. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -579,7 +579,7 @@ Returns the name node of the object. ### get_nested_class Returns a nested class by name from the current class. - + get_parameter Gets a specific parameter from the callable's parameters list by name. - + get_parameter_by_index Returns the parameter at the given index. - + get_parameter_by_type Retrieves a parameter from the callable by its type. - + get_parent_class Returns the parent class node with the specified name. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_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=""/> @@ -806,7 +806,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=""/> @@ -872,7 +872,7 @@ Find the 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 +880,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + subclasses Returns all classes which subclass this class. - + superclasses Returns a list of all classes that this class extends, up to max_depth. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [CodeBlock](/api-reference/core/CodeBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -133,7 +133,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 +141,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 +230,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=""/> @@ -438,7 +438,7 @@ Check if this node is contained another node of 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 +446,7 @@ Find the 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 +454,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 +590,7 @@ Unwraps a code block by removing its opening and closing braces. ### wrap Wraps a code block with a statement and indents it. - + + ### Inherits from [Comment](/api-reference/core/Comment), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -112,7 +112,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=""/> @@ -120,7 +120,7 @@ Find all ancestors of the node of the given type. Does not return itself ### clean_comment Cleans comment markers and whitespace from a comment string. - + edit Replace the source of this `Editable` with `new_src`. - + edit_text Replace the text of a comment with new text. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSComment ] } description=""/> @@ -243,7 +243,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### generate_comment Generates a TypeScript comment block from the given text content. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -391,7 +391,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -399,7 +399,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -407,7 +407,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) @@ -108,7 +108,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 +116,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this node with new text. - + edit_text Replace the text content of a comment group with new text. - + find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSCommentGroup ] } description=""/> @@ -222,7 +222,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -335,7 +335,7 @@ Check if this node is contained another node of 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 +343,7 @@ Find the 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 +351,7 @@ Reduces an editable to the following condition ### remove Removes this node and its related extended nodes from the codebase. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ## Attributes diff --git a/docs/api-reference/typescript/TSConditionalType.mdx b/docs/api-reference/typescript/TSConditionalType.mdx index 672f181d8..a5d7c7a05 100644 --- a/docs/api-reference/typescript/TSConditionalType.mdx +++ b/docs/api-reference/typescript/TSConditionalType.mdx @@ -15,7 +15,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) @@ -111,7 +111,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -119,7 +119,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node'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 +208,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 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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 @@ -72,7 +72,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### resolve_base_url Resolves an import path with the base url. - + str } description=""/> @@ -80,7 +80,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) @@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `Editable` with `new_src`. - + find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSDecorator ] } description=""/> @@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -204,7 +204,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -317,7 +317,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -333,7 +333,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Dict](/api-reference/core/Dict), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -92,7 +92,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 +100,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 +189,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 +302,7 @@ Check if this node is contained another node of 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 +310,7 @@ Find the 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 +318,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) @@ -170,7 +170,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 +253,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 +342,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. - + 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."/> @@ -419,7 +419,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -538,7 +538,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=""/> @@ -575,7 +575,7 @@ Find the 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 +583,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasValue](/api-reference/core/HasValue), [Export](/api-reference/core/Export), [Editable](/api-reference/core/Editable), [Exportable](/api-reference/core/Exportable), [Usable](/api-reference/core/Usable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName) @@ -144,7 +144,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 +152,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 +241,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Returns the import string for this export. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -284,7 +284,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."/> @@ -397,7 +397,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 +405,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 +430,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 +438,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 +463,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 +471,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 +479,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 +487,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 +495,7 @@ Find the 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 +503,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 +511,7 @@ Returns the import object that is re-exporting this symbol. ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + to_import_string Converts this export into its equivalent import string representation. - + str } description="The import string representation of this export. Examples: - For `export { foo } from './bar'` -> `import { foo } from './bar'` - For `export * from './bar'` -> `import * as _namespace from './bar'` - For `export { default as foo } from './bar'` -> `import foo from './bar'`"/> @@ -692,7 +692,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) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `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=""/> @@ -200,7 +200,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -208,7 +208,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=""/> @@ -321,7 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### 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) @@ -240,7 +240,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. - + 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. - + ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -380,7 +380,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_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 +486,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_class Returns a specific Class by full name. Returns None if not found. - + get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_config Returns the nearest tsconfig.json applicable to this file. - + TSConfig | None } description="The TypeScript configuration object if found, None otherwise."/> @@ -528,7 +528,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 +576,7 @@ Returns a list of file extensions that this class can parse. ### get_function Returns a specific Function by name. - + get_global_var Returns a specific global var by name. Returns None if not found. - + get_import Returns the import with matching alias. Returns None if not found. - + get_import_string Generates and returns an import statement for the file. - + get_interface Retrieves a specific interface from the file by its name. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -687,7 +687,7 @@ Returns the name node of the object. ### get_namespace Returns a specific namespace by name from the file's namespaces. - + get_symbol Gets a symbol by its name from the file. - + get_type Returns a specific Type by name from the file's types. - + get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + has_export_statement_for_path Checks if the file has exports of specified type that contains the given path in single or double quotes. - + has_import Returns True if the file has an import with the given alias. - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -891,7 +891,7 @@ Check if this node is contained another node of 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 +899,7 @@ Find the 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 +907,7 @@ Reduces an editable to the following condition ### remove Removes the file from the file system and graph. - + None } description=""/> @@ -915,7 +915,7 @@ Removes the file from the file system and graph. ### remove_unused_exports Removes unused exports from the file. - + None } description=""/> @@ -923,7 +923,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. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + set_name Sets the name of a code element. - + symbol_can_be_added Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + symbols Returns all Symbols in the file, sorted by position in the file. - + list[ 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"/> @@ -1116,7 +1116,7 @@ Returns all Symbols in the file, sorted by position in the file. ### update_filepath Updates the file path of the current file and all associated imports. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [ForLoopStatement](/api-reference/core/ForLoopStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -158,7 +158,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 +189,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 +278,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 +408,7 @@ Check if this node is contained another node of 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 +416,7 @@ Find the 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 +424,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) @@ -238,7 +238,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 +338,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 +363,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 +371,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 +460,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. - + 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."/> @@ -520,7 +520,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_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,7 +730,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=""/> @@ -767,7 +767,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 +792,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + rename_local_variable Renames a local variable and all its usages within a function body. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_return_type Sets the return type annotation for the function. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -107,7 +107,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -115,7 +115,7 @@ Find all ancestors of the node of the given type. Does not return itself ### asyncify Modifies the function type to be asynchronous by wrapping its return type in a Promise. - + None } description=""/> @@ -123,7 +123,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 +212,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 +325,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -333,7 +333,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -341,7 +341,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### 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) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Replace the source of this `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=""/> @@ -200,7 +200,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -208,7 +208,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=""/> @@ -321,7 +321,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -329,7 +329,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -337,7 +337,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasBlock](/api-reference/core/HasBlock), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +144,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 +233,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 +363,7 @@ Check if this node is contained another node of 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 +371,7 @@ Find the 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 +379,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [IfBlockStatement](/api-reference/core/IfBlockStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -142,7 +142,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 +150,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."/> @@ -193,7 +193,7 @@ Returns all elif blocks within the if block. ### find Find and return matching nodes or substrings within an Editable instance. - + find_string_literals Returns a list of string literals within this node's source that match any of the given - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSIfBlockStatement ] } description=""/> @@ -247,7 +247,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 +360,7 @@ Check if this node is contained another node of 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 +368,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) @@ -171,7 +171,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 +179,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 +268,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_import_string Generates an import string for an import statement. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -311,7 +311,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."/> @@ -424,7 +424,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 +466,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 +474,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 +482,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 +490,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 +498,7 @@ Check if this node is contained another node of 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 +506,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -514,7 +514,7 @@ Reduces an editable to the following condition ### remove Remove this import from the import statement. - + rename Renames the import symbol and updates all its usages throughout the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + resolve_import Resolves an import statement to its target file and symbol. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_import_module Sets the module of an import. - + set_import_symbol_alias Sets alias or name of an import at the declaration level. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [ImportStatement](/api-reference/core/ImportStatement), [Statement](/api-reference/core/Statement), [Editable](/api-reference/core/Editable), [Expression](/api-reference/core/Expression) @@ -117,7 +117,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 +125,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 +214,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 +327,7 @@ Check if this node is contained another node of 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 +335,7 @@ Find the 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 +343,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) @@ -178,7 +178,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 +261,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 +304,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,7 +358,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_attribute Returns the attribute with the given name, if it exists. - + Attribute | None } description=""/> @@ -366,7 +366,7 @@ Returns the attribute with the given name, if it exists. ### get_component Returns a specific JSX element from within this symbol's JSX elements. - + get_import_string Generates the appropriate import string for a symbol. - + get_name Returns the name node of the object. - + Name | 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."/> @@ -426,7 +426,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + implementations Returns all classes and interfaces that implement a given interface. - + list[Interface | Class ] } description=""/> @@ -457,7 +457,7 @@ Returns all classes and interfaces that implement a given interface. ### insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -553,7 +553,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=""/> @@ -590,7 +590,7 @@ Find the 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 +598,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [HasName](/api-reference/core/HasName), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -137,7 +137,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 +145,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=""/> @@ -234,7 +234,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -242,7 +242,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=""/> @@ -355,7 +355,7 @@ Check if this node is contained another node of 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 +363,7 @@ Find the 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 +371,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -104,7 +104,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 +112,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 +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=""/> @@ -314,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=""/> @@ -322,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=""/> @@ -330,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 [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) @@ -98,7 +98,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 +106,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=""/> @@ -195,7 +195,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | ChainedAttribute | None } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/> @@ -203,7 +203,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=""/> @@ -316,7 +316,7 @@ Check if this node is contained another node of 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 +324,7 @@ Find the 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 +332,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + + ### Inherits from [HasName](/api-reference/core/HasName), [TSHasBlock](/api-reference/typescript/TSHasBlock), [TSSymbol](/api-reference/typescript/TSSymbol), [HasBlock](/api-reference/core/HasBlock), [Exportable](/api-reference/core/Exportable), [Symbol](/api-reference/core/Symbol), [Expression](/api-reference/core/Expression), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable) @@ -173,7 +173,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 +256,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 +345,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 +353,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 +378,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 +386,7 @@ Get a function by name from this namespace. ### get_import_string Generates the appropriate import string for a symbol. - + get_interface Get an interface by name from this namespace. - + TSInterface | None } description=""/> @@ -429,7 +429,7 @@ Get an interface by name from this namespace. ### 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."/> @@ -437,7 +437,7 @@ Returns the name node of the object. ### get_namespace Get a namespace by name from this namespace. - + TSNamespace | None } description="The found namespace, or None if not found"/> @@ -445,7 +445,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,7 +453,7 @@ 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"/> @@ -461,7 +461,7 @@ Get a symbol by name from this namespace. ### get_type Get a type alias by name from this namespace. - + TSTypeAlias | None } description=""/> @@ -469,7 +469,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,7 +588,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=""/> @@ -625,7 +625,7 @@ Find the 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 +633,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Sets the name of an object and updates all its usages. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [TSDict](/api-reference/typescript/TSDict), [Expression](/api-reference/core/Expression), [Dict](/api-reference/core/Dict), [Editable](/api-reference/core/Editable) @@ -98,7 +98,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 +106,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 +195,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 +308,7 @@ Check if this node is contained another node of 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 +316,7 @@ Find the 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 +324,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [Pair](/api-reference/core/Pair), [HasValue](/api-reference/core/HasValue), [Editable](/api-reference/core/Editable) @@ -109,7 +109,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 +117,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 +206,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 +319,7 @@ Check if this node is contained another node of 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 +327,7 @@ Find the 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 +335,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_value Sets the value of the node's value Expression. - + + ### Inherits from [Parameter](/api-reference/core/Parameter), [HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Typeable](/api-reference/core/Typeable), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasName](/api-reference/core/HasName) @@ -139,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=""/> @@ -147,7 +147,7 @@ Find all ancestors of the node of the given type. Does not return itself ### convert_to_interface Converts a parameter's inline type definition to an interface. - + None } description=""/> @@ -155,7 +155,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=""/> @@ -244,7 +244,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_name Returns the name node of the object. - + Name | 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."/> @@ -252,7 +252,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before this node's source with optional indentation and newline handling. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -365,7 +365,7 @@ Check if this node is contained another node of the given class ### parent_of_type Find the first ancestor of the node of the given type. Does not return itself - + Editable | None } description=""/> @@ -373,7 +373,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -381,7 +381,7 @@ Reduces an editable to the following condition ### remove Removes the parameter from the function definition and all its call sites. - + rename Renames a parameter in a function definition and updates all related references. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_name Sets the name of a code element. - + set_type_annotation Sets the type annotation for this parameter. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -100,7 +100,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 +108,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 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts 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 +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=""/> @@ -318,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=""/> @@ -326,7 +326,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) @@ -100,7 +100,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 +108,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 +197,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts 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 +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=""/> @@ -318,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=""/> @@ -326,7 +326,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 +26,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### edit Modifies the return type annotation of a function. - + remove Removes this element from its parent container. - + None } description=""/> diff --git a/docs/api-reference/typescript/TSString.mdx b/docs/api-reference/typescript/TSString.mdx index 7e87c7d7d..e69c0cc13 100644 --- a/docs/api-reference/typescript/TSString.mdx +++ b/docs/api-reference/typescript/TSString.mdx @@ -20,7 +20,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; import {Attribute} from '/snippets/Attribute.mdx'; - + ### Inherits from [String](/api-reference/core/String), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +121,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 +210,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 +323,7 @@ Check if this node is contained another node of 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 +331,7 @@ Find the 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 +339,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) @@ -137,7 +137,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 +168,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 +257,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 +387,7 @@ Check if this node is contained another node of 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 +395,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_docstring Sets or updates a docstring for a code element. - + + ### Inherits from [SwitchStatement](/api-reference/core/SwitchStatement), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -113,7 +113,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 +121,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 +210,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 +323,7 @@ Check if this node is contained another node of 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 +331,7 @@ Find the 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 +339,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) @@ -149,7 +149,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 +209,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 +298,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. - + 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."/> @@ -341,7 +341,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=""/> @@ -460,7 +460,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=""/> @@ -497,7 +497,7 @@ Find the 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 +505,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [TernaryExpression](/api-reference/core/TernaryExpression), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -102,7 +102,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 +110,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 +199,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 +312,7 @@ Check if this node is contained another node of 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 +320,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Simplifies a ternary expression based on a boolean condition. - + remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + + ### Inherits from [TSBlockStatement](/api-reference/typescript/TSBlockStatement), [TryCatchStatement](/api-reference/core/TryCatchStatement), [TSHasBlock](/api-reference/typescript/TSHasBlock), [BlockStatement](/api-reference/core/BlockStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -137,7 +137,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 +168,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 +257,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 +387,7 @@ Check if this node is contained another node of 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 +395,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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) @@ -174,7 +174,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 +257,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 +346,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. - + 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."/> @@ -423,7 +423,7 @@ Returns the name node of the object. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + insert_after Inserts code after this node. - + insert_before Inserts text before the current symbol node in the Abstract Syntax Tree. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -542,7 +542,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=""/> @@ -579,7 +579,7 @@ Find the 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 +587,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + rename Renames a symbol and updates all its references in the codebase. - + replace Search and replace occurrences of text within this node's source and its extended nodes. - + search Returns a list of all regex match of `regex_pattern`, similar to python's re.search(). - + set_comment Sets a comment to the symbol. - + set_docstring Sets or updates a docstring for a code element. - + set_inline_comment Sets an inline comment to the symbol. - + set_name Sets the name of a code element. - + set_value Sets the value of the node's value Expression. - + symbol_usages Returns a list of symbols that use or import the exportable object. - + usages Returns a list of usages of the exportable object. - + + ### Inherits from [Type](/api-reference/core/Type), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -90,7 +90,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 +98,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 +187,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 +300,7 @@ Check if this node is contained another node of 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 +308,7 @@ Find the 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 +316,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) @@ -103,7 +103,7 @@ import {Attribute} from '/snippets/Attribute.mdx'; ### ancestors Find all ancestors of the node of the given type. Does not return itself - + list[ Editable ] } description=""/> @@ -111,7 +111,7 @@ Find all ancestors of the node of the given type. Does not return itself ### edit Edit the source for this Collection instance. - + None } description=""/> @@ -119,7 +119,7 @@ Edit the source for this Collection instance. ### find Search for substrings in the given symbols that match `strings_to_match`. - + find_string_literals Search for string literals matching given strings in the SymbolGroup. - + flag Adds a visual flag comment to the end of this Editable's source text. - + CodeFlag[ TSUnionType ] } description=""/> @@ -173,7 +173,7 @@ Adds a visual flag comment to the end of this Editable's source text. ### get_variable_usages Returns Editables for all TreeSitter nodes corresponding to instances of variable usage - + index Return the index of the first occurrence of value. - + int } description=""/> @@ -204,7 +204,7 @@ Return the index of the first occurrence of value. ### insert Adds `value` to the container that this node represents - + None } description=""/> @@ -212,7 +212,7 @@ Adds `value` to the container that this node represents ### insert_after Inserts source code after this node in the codebase. - + insert_before Inserts source code before this symbol group. - + is_wrapped_in Check if this node is contained another node of the given class - + bool } description=""/> @@ -302,7 +302,7 @@ Check if this node is contained another node of 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 +310,7 @@ Find the 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 +318,7 @@ Reduces an editable to the following condition ### remove Removes an element from a Collection. - + replace Replaces all instances of a string with a new string in all symbols within the group. - + search Searches for regex matches in the codebase. - + + ### Inherits from [TSHasBlock](/api-reference/typescript/TSHasBlock), [WhileStatement](/api-reference/core/WhileStatement), [HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable) @@ -137,7 +137,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 +168,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 +257,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 +387,7 @@ Check if this node is contained another node of 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 +395,7 @@ Find the first ancestor of the node of the given type. Does not return itself ### reduce_condition Reduces an editable to the following condition - + None } description=""/> @@ -403,7 +403,7 @@ Reduces an editable to the following condition ### remove Deletes this Node and its related extended nodes (e.g. decorators, comments). - + replace Search and replace occurrences of text within this 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. - + Date: Fri, 24 Jan 2025 17:06:58 -0800 Subject: [PATCH 3/7] added mdx doc generation sanity check --- .../sdk/code_generation/test_api_doc_generation.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py index 247e264bd..2e0c5f038 100644 --- a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py +++ b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py @@ -1,6 +1,7 @@ import pytest from codegen.sdk.ai.helpers import count_tokens +from codegen.sdk.code_generation.doc_utils.generate_docs_json import generate_docs_json from codegen.sdk.code_generation.prompts.api_docs import get_codegen_sdk_codebase, get_codegen_sdk_docs from codegen.sdk.core.symbol import Symbol from codegen.sdk.enums import ProgrammingLanguage @@ -46,6 +47,15 @@ def test_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> N # assert "InviteFactoryCreateParams" in docs # Canonicals aren't in docs +@pytest.mark.xdist_group("codegen") +@pytest.mark.parametrize("language", [ProgrammingLanguage.PYTHON, ProgrammingLanguage.TYPESCRIPT]) +def test_mdx_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> None: + codebase = get_codegen_sdk_codebase() + docs_json = generate_docs_json(codebase, "HEAD") + + assert len(docs_json.classes) > 0 + + @pytest.mark.xdist_group("codegen") @pytest.mark.parametrize("language", [ProgrammingLanguage.PYTHON, ProgrammingLanguage.TYPESCRIPT]) def test_get_codegen_sdk_codebase(codebase, language) -> None: From ddddfa52263c2e3dd98e9b4a8a9fe97fc2b5651e Mon Sep 17 00:00:00 2001 From: jemeza-codegen Date: Fri, 24 Jan 2025 17:16:12 -0800 Subject: [PATCH 4/7] test only needs to be ran once --- .../codegen/sdk/code_generation/test_api_doc_generation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py index 2e0c5f038..b4356acb0 100644 --- a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py +++ b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py @@ -48,8 +48,7 @@ def test_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> N @pytest.mark.xdist_group("codegen") -@pytest.mark.parametrize("language", [ProgrammingLanguage.PYTHON, ProgrammingLanguage.TYPESCRIPT]) -def test_mdx_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> None: +def test_mdx_api_doc_generation_sanity(codebase) -> None: codebase = get_codegen_sdk_codebase() docs_json = generate_docs_json(codebase, "HEAD") From 17c1df16948ecb1677b7720c890baf9f46cad7a9 Mon Sep 17 00:00:00 2001 From: jemeza-codegen Date: Fri, 24 Jan 2025 17:31:53 -0800 Subject: [PATCH 5/7] increased timeout --- .../unit/codegen/sdk/code_generation/test_api_doc_generation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py index b4356acb0..9b626fb3f 100644 --- a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py +++ b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py @@ -48,6 +48,7 @@ def test_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> N @pytest.mark.xdist_group("codegen") +@pytest.mark.timeout(60) def test_mdx_api_doc_generation_sanity(codebase) -> None: codebase = get_codegen_sdk_codebase() docs_json = generate_docs_json(codebase, "HEAD") From 9f7a7095febd891bb1c892ae7cde6f2980f5f2d2 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Mon, 27 Jan 2025 09:14:16 -0800 Subject: [PATCH 6/7] removed unused dependency and udpated test --- pyproject.toml | 1 - .../codegen/sdk/code_generation/test_api_doc_generation.py | 2 -- uv.lock | 5 +++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4e74fd2fa..e603bf90b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ dependencies = [ "wrapt<2.0.0,>=1.16.0", "pyright<2.0.0,>=1.1.372", "watchfiles<1.1.0,>=1.0.0", - "loguru<1.0.0,>=0.7.2", "rich<14.0.0,>=13.7.1", "pydantic<3.0.0,>=2.9.2", "docstring-parser<1.0,>=0.16", diff --git a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py index 9b626fb3f..d1897465a 100644 --- a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py +++ b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py @@ -48,9 +48,7 @@ def test_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> N @pytest.mark.xdist_group("codegen") -@pytest.mark.timeout(60) def test_mdx_api_doc_generation_sanity(codebase) -> None: - codebase = get_codegen_sdk_codebase() docs_json = generate_docs_json(codebase, "HEAD") assert len(docs_json.classes) > 0 diff --git a/uv.lock b/uv.lock index d7df49d4c..7a4d001bd 100644 --- a/uv.lock +++ b/uv.lock @@ -358,7 +358,7 @@ name = "click" version = "8.1.8" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } wheels = [ @@ -367,6 +367,7 @@ wheels = [ [[package]] name = "codegen" +version = "0.5.3.dev23+g28194e2" source = { editable = "." } dependencies = [ { name = "anthropic" }, @@ -2554,7 +2555,7 @@ name = "tqdm" version = "4.67.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 } wheels = [ From 06705de99db046da9c18e1f214c5e9feafb39c01 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Mon, 27 Jan 2025 09:25:05 -0800 Subject: [PATCH 7/7] increased timeout on test --- .../unit/codegen/sdk/code_generation/test_api_doc_generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py index d1897465a..aa1753837 100644 --- a/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py +++ b/tests/unit/codegen/sdk/code_generation/test_api_doc_generation.py @@ -47,7 +47,7 @@ def test_api_doc_generation_sanity(codebase, language: ProgrammingLanguage) -> N # assert "InviteFactoryCreateParams" in docs # Canonicals aren't in docs -@pytest.mark.xdist_group("codegen") +@pytest.mark.timeout(120) def test_mdx_api_doc_generation_sanity(codebase) -> None: docs_json = generate_docs_json(codebase, "HEAD")