Code completions are not shown complete on the VSCode UI because extension sends the json payload with CRLF line endings

Checklist

Summary

Code completion is showing incomplete results on VSCode IDE is used when VSCode doesn't enforce LF line endings because the payload has CLRF line endings.

Steps to reproduce

  1. Use the API to generate code completions.
  2. In the current_file.content_above_cursor and current_file.content_below_cursor use \r\n instead of \n.
  3. Response generated is partial and not complete
  4. Alternatively, use VSCode with CLRF line endings.

What is the current bug behavior?

Code suggestions are incomplete

What is the expected correct behavior?

Code suggestions should be complete even when CLRF line endings used in VSCode.

Relevant logs and/or screenshots

Workaround

Configure VS Code to use Unix line endings by default:

  1. Open Settings (Ctrl + ,).
  2. Search for "End of Line".
  3. Set "Files: Eol" to \n (LF).