Skip to content
Grégoire Geis edited this page Dec 2, 2023 · 2 revisions

Dance has limited support for Helix features.

Some of the features below are only available if the tree-sitter-api extension (currently only available as a .vsix) is installed.

Tree-Sitter based queries

  • dance.seek.askObject (typically invoked through a-i or a-a) now accepts a custom pattern: (?#textobject=...) with ... a supported capture without the .inside / .around suffix.

    Usage with a-i and a-a

    Add this to settings.json to add new entries to the object menu, used by a-i and a-a:

      "dance.menus": {
          "object": {
              "items": {
                  "t": {
                      "text": "class",
                      "command": "dance.seek.object",
                      "args": [{
                          "input": "(?#textobject=class)"
                      }],
                  },
                  "f": {
                      "text": "function",
                      "command": "dance.seek.object",
                      "args": [{
                          "input": "(?#textobject=function)"
                      }],
                  },
                  "A": {
                      "text": "parameter",
                      "command": "dance.seek.object",
                      "args": [{
                          "input": "(?#textobject=parameter)"
                      }],
                  },
                  "c": {
                      "text": "comment",
                      "command": "dance.seek.object",
                      "args": [{
                          "input": "(?#textobject=comment)"
                      }],
                  },
                  "T": {
                      "text": "test",
                      "command": "dance.seek.object",
                      "args": [{
                          "input": "(?#textobject=test)"
                      }],
                  },
              }
          },
      },

    Note that A is assigned to parameter rather than a since a is already defined by the default Dance config.

  • dance.seek.syntax.{next,previous,parent,child}.experimental can be used to navigate the Tree Sitter syntax tree. Unlike the textobject query above, however, this command does not use Helix textobjects and therefore navigates in very small increments.

Tree-Sitter based commands

  • v can be defined in keybindings.json using the following configuration:

    {
      "key": "v",
      "command": "dance.modes.set.select",
      "when": "editorTextFocus && dance.mode == 'normal'",
    },

Other differences