cody
cody copied to clipboard
Edit: Improve formatting logic, or provide generic formatting
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
insertionPointof 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