Luasnip snippet with condition

how to use treesitter to only trigger a snippet if I sm not in a commented line?

I have tested regex but with no success

snip({
        trig = 'if',
        snippetType = 'autosnippet',
        -- condition = function()
        --   return not vim.api.nvim_get_current_line():match('^%s*--.*$')
        -- end,
      },
      fmt([[
        if {} then
          {}
        end
        ]], {
        -- i(1) is at nodes[1], i(2) at nodes[2].
        i(1, "condition"), i(2, "action")
      })),