zed icon indicating copy to clipboard operation
zed copied to clipboard

dart: code snippet Incorrect filling

Open d1y opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

stl | stf filled with incorrect label text instead of code snippets

Flutter Stateless Widget
Flutter Stateful Widget

https://github.com/user-attachments/assets/fe213dac-c7ef-48d5-b64f-7178f7c3c598

Environment

Zed: v0.148.0 (Zed Nightly 990774247ecb61ddf69f0325d28eb3b203fc3699) OS: macOS 15.0.0 Memory: 16 GiB Architecture: aarch64

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

No response

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

Zed.log

d1y avatar Aug 07 '24 08:08 d1y

Zed Snippets Guide read, to create Custom Snippets.

  1. ~/.config/zed/snippets/dart.json Create a file in the path. (or download file to the path)
  2. Copy and paste the code below into your ~/.config/zed/snippets/dart.json

now You can insert StatelessWidget via the "stl", "stless" prefix, StatefulWidget via the "stful", "stf" prefix

P.S - There is an issue with the escape sequence not working if it is at the beginning of the line.

{
  "Flutter StatelessWidget": {
    "prefix": ["stless", "stl"],
    "body": [
      "class $0 extends StatelessWidget {",
      "\tconst $0({super.key});\n",
      "\t@override",
      "\tWidget build(BuildContext context) {",
      "\t\treturn Container();",
      "\t}",
      "}\n"
    ],
    "description": "Insert Flutter StatelessWidget"
  },
  "Flutter StatefulWidget": {
    "prefix": ["stful", "stf"],
    "body": [
      "class $0 extends StatefulWidget {",
      "\tconst $0({super.key});\n",
      "\t@override",
      "\tState<$0> createState() => _$0State();",
      "}\n",
      "class _$0State extends State<$0> {",
      "\t@override",
      "\tWidget build(BuildContext context) {",
      "\t\treturn Container();",
      "\t}",
      "}\n"
    ],
    "description": "Insert Flutter StatelessWidget"
  }
}

C0routine avatar Oct 09 '24 06:10 C0routine

I am facing this as well after Signing in. Even after logging out, it still doesn't work.

silvan-talos avatar Oct 20 '24 19:10 silvan-talos

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar Mar 18 '25 11:03 github-actions[bot]

This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue.

github-actions[bot] avatar Mar 25 '25 11:03 github-actions[bot]