Skip to content

Update Docs and System Prompts #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 13, 2025
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
36 changes: 18 additions & 18 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-L156" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L30-L163" />

### Inherits from
[HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable)
Expand Down Expand Up @@ -95,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-L121" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/detached_symbols/argument.py#L112-L128" />

<ParameterWrapper>
<Parameter
Expand All @@ -112,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#L1088-L1096" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1101-L1109" />


<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#L632-L660" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L637-L665" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -155,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#L482-L499" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L487-L504" />

<ParameterWrapper>
<Parameter
Expand All @@ -178,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#L394-L408" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L398-L412" />

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


<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="A list of Editable objects representing the matching string literals."/>
<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>[</span> <a href="/api-reference/core/Argument" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Argument</a> <span>]]</span></> } description="A list of Editable objects representing the matching string literals."/>


### <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#L926-L937" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L939-L950" />


<Return return_type={ <><span>CodeFlag[</span> <a href="/api-reference/core/Argument" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Argument</a> <span>]</span></> } description=""/>
Expand All @@ -217,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#L902-L918" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L909-L925" />

<ParameterWrapper>
<Parameter
Expand All @@ -235,12 +235,12 @@ Returns Editables for all TreeSitter nodes corresponding to instances of variabl
</ParameterWrapper>


<Return return_type={ <><span>list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]</span></> } description="List of Editable objects representing variable usage nodes matching the given name."/>
<Return return_type={ <><span>Sequence[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>[</span> <a href="/api-reference/core/Argument" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Argument</a> <span>]]</span></> } description="List of Editable objects representing variable usage nodes matching the given name."/>


### <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#L603-L629" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L608-L634" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -281,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#L570-L600" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L575-L605" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -322,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#L1074-L1076" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1087-L1089" />


<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#L1079-L1085" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1092-L1098" />


<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#L1030-L1035" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L1043-L1048" />


<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#L682-L697" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L687-L702" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -392,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#L427-L451" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L432-L456" />

<ParameterWrapper>
<Parameter
Expand Down Expand Up @@ -433,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#L515-L531" />
<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/develop/src/codegen/sdk/core/interfaces/editable.py#L520-L536" />

<ParameterWrapper>
<Parameter
Expand Down
Loading