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

Reduce the probability of errors when the model tries to fix the problems #996

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

qdaxb
Copy link

@qdaxb qdaxb commented Feb 14, 2025

Reduce the probability of errors when the model tries to fix the problems due to mismatched line numbers after applying diff

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

When using deepseek to generate code, occasionally there will be a compilation error after apply diff, and the model cannot perceive the correct line number, resulting in the wrong problem being fixed.

After sending the contents of the error row to the model, no similar problems occurred.

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Fix asynchronous handling of diagnostics to ensure accurate line content in error messages after applying diffs.

  • Behavior:
    • getWorkspaceProblems in index.ts now returns a Promise<string> to handle asynchronous operations.
    • diagnosticsToProblemsString in index.ts and diagnostics/index.ts now returns a Promise<string>, fetching line content for diagnostics.
    • DiffViewProvider in DiffViewProvider.ts now awaits diagnosticsToProblemsString to ensure accurate diagnostics after edits.
  • Functions:
    • getWorkspaceProblems and diagnosticsToProblemsString updated to include line content in diagnostics output.
    • DiffViewProvider.saveChanges() updated to handle asynchronous diagnostics processing.
  • Misc:
    • Minor refactoring to ensure asynchronous handling of diagnostics in index.ts and diagnostics/index.ts.

This description was created by Ellipsis for 42371bd. It will automatically update as commits are pushed.

Copy link

changeset-bot bot commented Feb 14, 2025

⚠️ No Changeset found

Latest commit: fbf65bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@qdaxb qdaxb force-pushed the optimize_diagnostics branch from 42371bd to 0262835 Compare February 14, 2025 16:00
…lem due to mismatched line numbers after applying diff
@qdaxb qdaxb force-pushed the optimize_diagnostics branch from 0262835 to fbf65bf Compare February 14, 2025 16:04
Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

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

Can you tell me more about how this works? It’s waiting longer / more appropriately for errors to show up?

@qdaxb
Copy link
Author

qdaxb commented Feb 18, 2025

Can you tell me more about how this works? It’s waiting longer / more appropriately for errors to show up?

No, when an error occurs, the previous logic only sends the error line number and error message. After apply_diff, the line number that the model thinks may not match the actual line number.

The new logic will send the content of the current line to the model to avoid this problem.

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.

2 participants