zed icon indicating copy to clipboard operation
zed copied to clipboard

Snippets selection should use key as label

Open andyw8 opened this issue 8 months ago • 2 comments

Summary

Snippet selection currently uses the description value in the selection menu, which is typically longer than the key and may need to be truncated.

For example, with the snippet:

{
  "Begin rescue ensure": {
    "prefix": ["begin"],
    "body": ["begin", "  $0", "rescue $1", "ensure", "end", ""],
    "description": "New Ruby begin block with rescue and ensure."
  }
}

Zed will show:

Image

Compare that to VS Code:

Image

Zed Version and System Specs

Zed: v0.180.2 (Zed) OS: macOS 15.3.0 Memory: 16 GiB Architecture: aarch64

andyw8 avatar Apr 03 '25 15:04 andyw8

This makes sense. We should use the key in the completion menu and show the description in the aside menu for the snippet that is in the selected state.

smitbarmase avatar May 06 '25 15:05 smitbarmase

I’d like to take on this issue and work on the fix. I will update the snippet rendering logic to display the snippet key as the primary label in the dropdown instead of the description. can u assign it to me?

iamJ3 avatar May 08 '25 07:05 iamJ3