zed icon indicating copy to clipboard operation
zed copied to clipboard

Cant add custom postfix snippets

Open codeitlikemiley opened this issue 1 year ago • 0 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

The Official Documentation cited that we can add postfix snippets

https://zed.dev/docs/languages/rust#snippets

add println
"lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "completion": {
          "snippets": {
            "custom": {
              "Arc::new": {
                "postfix": "arc",
                "body": ["Arc::new(${receiver})"],
                "requires": "std::sync::Arc",
                "scope": "expr"
              },
              "println": {
                "postfix": "print",
                "body": ["println!(\"{:?}\",${receiver})"],
                "scope": "expr"
              },
              "Some": {
                "postfix": "some",
                "body": ["Some(${receiver})"],
                "scope": "expr"
              },
              "Ok": {
                "postfix": "ok",
                "body": ["Ok(${receiver})"],
                "scope": "expr"
              },
              "Rc::new": {
                "postfix": "rc",
                "body": ["Rc::new(${receiver})"],
                "requires": "std::rc::Rc",
                "scope": "expr"
              },
              "Box::pin": {
                "postfix": "boxpin",
                "body": ["Box::pin(${receiver})"],
                "requires": "std::boxed::Box",
                "scope": "expr"
              },
              "vec!": {
                "postfix": "vec",
                "body": ["vec![${receiver}]"],
                "description": "vec![]",
                "scope": "expr"
              }
            }
          }
        }
      }
    }
  }

Environment

Im using MacOSx

If applicable, add mockups / screenshots to help explain present your vision of the feature

I tried to add the above snippets for println

i tried to add . and print it doesnt work

Screenshot 2024-08-25 at 11 19 00 PM

but doing . and arc shows the Arc::new() postfix completions

If applicable, attach your Zed.log file to this issue.

No response

codeitlikemiley avatar Aug 25 '24 15:08 codeitlikemiley