Skip to content

Space within an element breaks the snippet flow #254

Open
@ubitux

Description

@ubitux

In (C) friendly snippets, we can see the following mal snippet:

  "Allocate memory using malloc": {
    "prefix": "mal",
    "body": [
      "${1:int} *${2:v} = malloc(${3:1} * sizeof($1));",
      "",
      "if (!$2) {",
      "\tfprintf(stderr, \"Memory allocation failed!\\n\");",
      "\t$4;",
      "}",
      "$0",
      "free($2);"
    ],
    "description": "Allocates memory to a pointer variable using malloc(), then deallocates using free()."
  },

For the first item (${1:int}), if need to use a struct type such as struct foobar, the presence of the <SPACE> between struct and foobar will actually prevent jumping to the next item.

I'm not sure if that's a bug or a known limitation, but since this is a very common pattern to use in C I thought it was worth raising it up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions