mjlbach/starter.nvim

Tree-sitter

Closed this issue · 4 comments

I've freed roughly 20 lines from the configuration which leaves just enough room for tree-sitter support. I'm not quite sure if this belongs yet (I don't use tree-sitter regularly), but up for discussion!

I think you should add treesitter support.

A couple thoughts (off the cuff):

Cons:

  1. Treesitter first parse is still "slow", this may give people the impression this configuration is "slower"
  2. Treesitter still has issues/bugs that may make it not daily driver worth for who this targets (desynchronization of highlights, crashing, abi mismatches on updates not being intuitive to resolve)
  3. Treesitter grammars require compiling, which means I'd have to add nix/guix specific logic to maintain compatibility (external package managers)

Pro: All the niceties that come with treesitter, highlighting, some good code motions, etc.

I'm definitely in favor of adding TS support eventually, right now it would just be as simple as adding:

require'nvim-treesitter.configs'.setup {
  -- debatable whether this should be commented or not
  -- ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
  highlight = {
    enable = true,              -- false will disable the whole extension
  },
  incremental_selection = {
    enable = true,
    keymaps = {
      init_selection = "gnn",
      node_incremental = "grn",
      scope_incremental = "grc",
      node_decremental = "grm",
    },
  },
  indent = {
    enable = true
  }
}

I have not encountered any crashes yet, and the JS/TS highlighting is so much better I can't go back to the old.

I didn't think the grammars needed compiling any more for a standard install? I remember months ago some did, but I did a fresh install recently and no longer needed to compile anything.

You know a lot more than me about it, so add Treesitter when you think it is best!

Treesitter support is in.