Skip to content

Can a treesitter_prefix snippet be implemented with luasnip? #1377

@oiiiiiiii

Description

@oiiiiiiii

Currently there exists a treesitter_postfix snippet which works really well. But is there a way to also have a tresitter_prefix snippet? That would be really helpful to generate javadoc comments, e.g. when I have this method cursor marked with _:

_
public int sum(int x, int y) {
    return x + y;
}

and I type some trigger, I would like to get something like this

/**
 * <p>$1</p>
 * @param x $2
 * @param y $3
 * @return $4
 */
public int sum(int x, int y) {
    return x + y;
}

So basically I want to filter the arguments of the method using tresitter, but not the node before the cursor but after. But because there is no tresitter_prefix snippet I'm not sure how I could implement that.

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