Skip to content

Rpatel/embedded codemod widget #63

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 2 commits into from
Jan 24, 2025
Merged
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
35 changes: 34 additions & 1 deletion docs/introduction/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,40 @@ iconType: "solid"

It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/).

<iframe src="https://chadcode.sh/embedded/123" className="w-full h-96"></iframe>
export const intoSnippet = `# grabs codebase content

file = codebase.files[0] # or .get_file("test.py")
function = codebase.functions[0] # or .get_symbol("my_func")

# print logs

print(f'# of files: {len(codebase.files)}')
print(f'# of functions: {len(codebase.functions)}')

# make edits

file.edit('🌈' + file.content) # edit contents
function.rename('new_name') # rename
function.set_docstring('new docstring') # set docstring

# ... etc.

`

<iframe
width="100%"
height="300px"
scrolling="no"
src={`https://www.chadcode.sh/embedded/codemod/?code=${encodeURIComponent(
intoSnippet
)}`}
className="rounded-md"
style={{
borderRadius: "0.5rem",
borderColor: "rgb(var(--primary-light))",
borderWidth: "1px",
}}
></iframe>

## Installation

Expand Down
Loading