Skip to content

fix: prevent lines removal on docstring insertion #6364

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Jul 1, 2025

Description

When generating docstring using the Continue menu > "Write a docstring for this code", it used to delete all lines after the first. This PR fix this behaviour.

  • inside "continue.writeDocstringForCode" vscode command, for streamInlineEdit's onlyOneInsertion is now set to false

closes #4126

resolves CON-2048

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

Reproduction

This is flaky on the main branch - it works correctly on some code while not on other.
This code mostly gives removes the line after adding the lines so it can be used for testing.

def get_pc_model_class(name):
    global REGISTERED_PC_DATASET_CLASSES
    assert name in REGISTERED_PC_DATASET_CLASSES, f"available class: {REGISTERED_PC_DATASET_CLASSES}"
    return REGISTERED_PC_DATASET_CLASSES[name]

Summary by cubic

Fixed an issue where inserting a docstring using the Continue menu would remove lines after the first, preserving the rest of the code.

@uinstinct uinstinct requested a review from a team as a code owner July 1, 2025 08:01
@uinstinct uinstinct requested review from sestinj and removed request for a team July 1, 2025 08:01
Copy link

netlify bot commented Jul 1, 2025

👷 Deploy request for continuedev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3323f18

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 1, 2025
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to review

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pausing merging while we compare with
#6159
which updates the onlyOneInsertion logic
onlyOneInsertion appears to only be used for docstring, so wondering why it was added in the first place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Code will be deleted when writing a doc string
2 participants