Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 17 additions & 33 deletions docs/api-reference/core/Argument.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx';
import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx';
import {Attribute} from '/snippets/Attribute.mdx';

<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L30-L155" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L30-L156" />

### Inherits from
[HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable)
Expand All @@ -30,11 +30,6 @@ import {Attribute} from '/snippets/Attribute.mdx';
<HorizontalDivider light={true} />
<Attribute type={ <><a href="/api-reference/core/SourceFile" style={ {fontWeight: "inherit", fontSize: "inherit"} }>SourceFile</a></> } description="The file object that this Editable instance belongs to." />

### <span className="text-primary">file_node_id</span>
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">NodeId</code> } description="
" />

### <span className="text-primary">filepath</span>
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The file path of the file that this Editable instance belongs to." />
Expand All @@ -59,15 +54,9 @@ import {Attribute} from '/snippets/Attribute.mdx';
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str | None</code> } description="Retrieves the base name of the object without namespace prefixes." />

### <span className="text-primary">node_type</span>
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">NodeType</code> } description="
" />

### <span className="text-primary">parent</span>
<HorizontalDivider light={true} />
<Attribute type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a></> } description="
" />
<Attribute type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a></> } description="The parent node of this Editable instance." />

### <span className="text-primary">parent_class</span>
<HorizontalDivider light={true} />
Expand All @@ -89,11 +78,6 @@ import {Attribute} from '/snippets/Attribute.mdx';
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Text representation of the Editable instance." />

### <span className="text-primary">ts_node</span>
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">TSNode</code> } description="
" />

### <span className="text-primary">type</span>
<HorizontalDivider light={true} />
<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Gets the `Tree-sitter` type of the argument's value node." />
Expand All @@ -111,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
<HorizontalDivider />
### <span className="text-primary">add_keyword</span>
Converts an unnamed argument to a named argument by adding a keyword.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L105-L120" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L105-L121" />

<ParameterWrapper>
<Parameter
Expand All @@ -128,15 +112,15 @@ Converts an unnamed argument to a named argument by adding a keyword.

### <span className="text-primary">ancestors</span>
Find all ancestors of the node of the given type. Does not return itself
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1082-L1090" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1088-L1096" />


<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description=""/>


### <span className="text-primary">edit</span>
Replace the source of this `Editable` with `new_src`.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L626-L654" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L632-L660" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -171,7 +155,7 @@ Replace the source of this `Editable` with `new_src`.

### <span className="text-primary">find</span>
Find and return matching nodes or substrings within an Editable instance.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L476-L493" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L482-L499" />

<ParameterWrapper>
<Parameter
Expand All @@ -194,7 +178,7 @@ Find and return matching nodes or substrings within an Editable instance.

### <span className="text-primary">find_string_literals</span>
Returns a list of string literals within this node's source that match any of the given
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L388-L402" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L394-L408" />

<ParameterWrapper>
<Parameter
Expand All @@ -217,7 +201,7 @@ Returns a list of string literals within this node's source that match any of th

### <span className="text-primary">flag</span>
Adds a visual flag comment to the end of this Editable's source text.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L920-L931" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L926-L937" />


<Return return_type={ <><span>CodeFlag[</span> <a href="/api-reference/core/Argument" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Argument</a> <span>]</span></> } description=""/>
Expand All @@ -233,7 +217,7 @@ Returns the name node of the object.

### <span className="text-primary">get_variable_usages</span>
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L896-L912" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L902-L918" />

<ParameterWrapper>
<Parameter
Expand All @@ -256,7 +240,7 @@ Returns Editables for all TreeSitter nodes corresponding to instances of variabl

### <span className="text-primary">insert_after</span>
Inserts code after this node.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L597-L623" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L603-L629" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -297,7 +281,7 @@ Inserts code after this node.

### <span className="text-primary">insert_before</span>
Inserts text before this node's source with optional indentation and newline handling.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L564-L594" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L570-L600" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -338,31 +322,31 @@ Inserts text before this node's source with optional indentation and newline han

### <span className="text-primary">is_wrapped_in</span>
Check if this node is contained another node of the given class
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1068-L1070" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1074-L1076" />


<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">bool</code> } description=""/>


### <span className="text-primary">parent_of_type</span>
Find the first ancestor of the node of the given type. Does not return itself
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1073-L1079" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1079-L1085" />


<Return return_type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> } description=""/>


### <span className="text-primary">reduce_condition</span>
Reduces an editable to the following condition
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1024-L1029" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1030-L1035" />


<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/>


### <span className="text-primary">remove</span>
Deletes this Node and its related extended nodes (e.g. decorators, comments).
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L676-L691" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L682-L697" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -408,7 +392,7 @@ Sets the name of an object and updates all its usages.

### <span className="text-primary">replace</span>
Search and replace occurrences of text within this node's source and its extended nodes.
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L421-L445" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L427-L451" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -449,7 +433,7 @@ Search and replace occurrences of text within this node's source and its extende

### <span className="text-primary">search</span>
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L509-L525" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L515-L531" />

<ParameterWrapper>
<Parameter
Expand Down
Loading
Loading