Skip to content
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

Improve incremental document update #4277

Merged
merged 1 commit into from
May 23, 2024

Conversation

pkukielka
Copy link
Contributor

Test plan

In a client:

  1. open sourcegraph/cody , execute.ts file
  2. Select whole ExecuteEditArguments interface block
  3. Click Document Code
  4. Undo edit (from inlay lens)
  5. Click Document Code again -> comments will appear in wrong

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

Good catch. I will followup with a minor changes, but this is a great start

@olafurpg olafurpg merged commit 8ced089 into main May 23, 2024
19 checks passed
@olafurpg olafurpg deleted the pkukielka/improve-incremental-document-update branch May 23, 2024 17:38
reason: undefined,
})

if (contentChanges) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will always be true even if contentChanges is empty right? Cause Boolean([]) returns true ?
Will need to update to:

Suggested change
if (contentChanges) {
if (contentChanges?.length) {

Copy link
Member

Choose a reason for hiding this comment

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

ha, I was just opening this PR to make the same comment, will fix in a followup PR

Copy link
Contributor

Choose a reason for hiding this comment

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

haha It's been fixed @olafurpg! #4278

Copy link
Member

Choose a reason for hiding this comment

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

olafurpg added a commit that referenced this pull request May 23, 2024
The PR #4277 was a lesson that
we have very brittle code around dealing with document synchronization.
This PR is an attempt to improve code health by

- Adding tests!
- Being more rigorous with null handling
- Making the code a bit easier to follow (hopefully)
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.

3 participants