Skip to content

CG-10465 raw text edit #170

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 5 commits into from
Jan 29, 2025
Merged

Conversation

tkfoss
Copy link
Contributor

@tkfoss tkfoss commented Jan 29, 2025

Motivation

File(name="doc.mdx").edit(...) and .replace(...) should edit in place. Right now it's appending.

Content

New File methods.

Testing

UT, manual testing.

Please check the following before marking your PR as ready for review

  • I have added tests for my changes
  • I have updated the documentation or added new documentation as needed
  • I have read and agree to the Contributor License Agreement

@tkfoss tkfoss requested a review from codegen-team as a code owner January 29, 2025 00:58
Copy link

linear bot commented Jan 29, 2025

CG-10465 `File(name="doc.mdx").edit(...)` and `.replace(...)`

This should instead edit in place

See failing unit test:

pytest.mark.skip("MDX editing is broken")
def test_codebase_edit_mdx(tmpdir) -> None:
    """Editing MDx seems broken currently - it will just prepend to the file"""
    with get_codebase_session(tmpdir=tmpdir, files={"file1.mdx": "# Header", "file2.tsx": "console.log('hello, world!')"}) as codebase:
        file = codebase.get_file("file1.mdx")
        file.edit("NEW TEXT")
        codebase.commit()
        file = codebase.get_file("file1.mdx")
        assert file.content == "NEW TEXT" # FAILS HERE

See both tests here: https://github.com/codegen-sh/codegen-sdk/pull/61/files#diff-4c59eb8de2ddb0302e1e182485d837998ede3bdcad2cb47f79f25f2dbac8aaf0

@tkfoss tkfoss requested a review from a team as a code owner January 29, 2025 21:44
@tkfoss tkfoss requested review from EdwardJXLi and removed request for a team January 29, 2025 21:44
@CLAassistant
Copy link

CLAassistant commented Jan 29, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ tomcodgen
❌ codegen-bot


codegen-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@tkfoss tkfoss merged commit 815d063 into develop Jan 29, 2025
4 of 8 checks passed
@tkfoss tkfoss deleted the tom-cg-10465-filenamedocmdxedit-and-replace branch January 29, 2025 21:46
jayhack pushed a commit that referenced this pull request Feb 9, 2025
# Motivation
File(name="doc.mdx").edit(...) and .replace(...) should edit in place.
Right now it's appending.

# Content
New File methods.

# Testing
UT, manual testing.

# Please check the following before marking your PR as ready for review

- [x] I have added tests for my changes
- [x] I have updated the documentation or added new documentation as
needed
- [x] I have read and agree to the [Contributor License
Agreement](../CLA.md)

Co-authored-by: codegen-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants