zed/crates/assistant_slash_command
Marshall Bowers 91bbf0efc4
assistant: Normalize line endings for prompts loaded from the prompt library (#15708)
This PR makes it so we normalize the line endings for prompts to LFs
(`\n`) when we load a prompt from the library.

In some cases, prompts could end up with CRLF (`\r\n`) line endings.
When these prompts were used with the `/prompt` slash command and
summarily run, the prompt text would be converted into a rope, causing
the line endings to be normalized to LFs.

However, this would happen _after_ the ranges for the
`SlashCommandOutputSection`s were computed based on the text that still
contained the CRLFs. This would then cause these ranges to be invalid
for the text with the normalized endings, resulting in a panic when
converting them to anchors.

Fixes https://github.com/zed-industries/zed/issues/15652.

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-08-02 18:13:17 -04:00
..
src assistant: Normalize line endings for prompts loaded from the prompt library (#15708) 2024-08-02 18:13:17 -04:00
Cargo.toml Preserve sections generated by slash commands when reloading a context (#13199) 2024-06-18 14:49:53 +02:00
LICENSE-GPL Extract SlashCommand trait from assistant (#12252) 2024-05-24 13:03:41 -04:00