Skip to content

[documentation] luasnip conditions have to be functions evaluating to a boolean #47

@grepgrok

Description

@grepgrok

luasnip expects conditions to be of type fn(line_to_cursor, matched_trigger, captures) -> bool. When trying to use is_math (or not_math for that matter) as a condition (even with utils.pipe) for custom snippets, users need to convert the fn(treesitter: bool) -> bool to the expected type. As it stands, simply using condition = utils.is_math fails if you aren't using treesitter since the fuzzy types always flag this check as true.

The fix is easy enough: import as something like local is_math = utils.with_opts(utils.is_math, { false }) or local is_math = function() return utils.is_math() end

Can we update this in the docs/example

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