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

Edit: Improve formatting logic, or provide generic formatting #4093

Open
umpox opened this issue May 8, 2024 · 0 comments
Open

Edit: Improve formatting logic, or provide generic formatting #4093

umpox opened this issue May 8, 2024 · 0 comments
Assignees
Labels
bug Something isn't working clients/vscode cody

Comments

@umpox
Copy link
Contributor

umpox commented May 8, 2024

What:

  • Currently we use the users' default formatter to format the output of an Edit, immediately after it is applied to the document.
  • This is ok but it's problematic because:
    • We're relying on another extension here, it needs to work well, fast and be bug-free. Otherwise users' just see that Cody produced some poorly formatted code.
  • We have also had recent cases where the formatting logic seems to have broken completely, and removed all indentation. This may be due to a bug in VS Code but it still is out of our hands.

How:

  • Explore if there's any other VS Code APIs available to us to format an portion of text to a users' liking.
  • Provide our own agnostic formatting logic, it should:
    • Check the spaces/tabs settings in the editor.
    • Determine the correct insertionPoint of the edit, and adjust the indentation of all subsequent lines depending on this, and the configured tab/space settings.
      • Match the existing start, if editing a range of text
      • Determine the correct indentation of a new line, if inserting new text
@umpox umpox added bug Something isn't working clients/vscode labels May 8, 2024
@github-actions github-actions bot added the cody label May 8, 2024
@umpox umpox changed the title e Edit: Improve formatting logic, or provide generic formatting May 8, 2024
@umpox umpox self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clients/vscode cody
Projects
None yet
Development

No branches or pull requests

1 participant