AI: unable to add selection to context for unsaved/untitled buffers without a filename
Summary
I wanted to run a quick AI-assisted fixup for some json. I created a new buffer, pasted the text, manually selected the language to be Json.
I selected the relevant part of the json, and tried to use the AI panel, but it wouldn't add the selection to the context. Only after saving the file I was able to use it (with or without selection)
Description
Steps to trigger the problem:
- Create a new untitled buffer
- Select some text, try adding it to the AI context via
Selection
Actual Behavior: Nothing is added to the AI context
Expected Behavior: Selected text is added to the AI context even for an unsaved buffer without a filename.
Zed Version and System Specs
Zed: v0.187.6 (Zed) OS: Linux Wayland nixos 25.11 Memory: 27.1 GiB Architecture: x86_64 GPU: AMD Radeon Graphics (RADV PHOENIX) || radv || Mesa 25.1.1
I can reproduce. Thanks for reporting. Steps to reproduce:
cmd-n (new buffer) type something: foobar cmd-a (select all) cmd-shift-> (assistant: quote selection) Result: No-op
cmd-s (save) and specify a filename cmd-shift-> Result: Works as expected
Closing this as it seems to be fixed/working already!