Skip to content

Fixing Neovim Treesitter breaking changes

The sun is out, the sky is blue... and I had the opportunity to understand some Neovim plugins a little more, in order to fix a breaking change with Neovim Treesitter support for Clojure.

Pull Requests this week

Neovimλ︎

A breaking change in nvim-treesitter affects the nvim-treesitter-sexp plugin which provides paredit style structural editing for Clojure.

nvim-treesitter committed a change that requires queries to use kind-eq? rather than the previous has-type?.

The breaking change only affected the queries for the Clojure language, all other languages supported by nvim-treesitter-sexp were unaffected.

A quick solution would be to pin nvim-treesitter plugin to an earlier version, such as v0.9.2 released on 19 January 2024

Pin plugin to specific version

  "nvim-treesitter/nvim-treesitter",
  version = "0.9.2",

A plugin can be pinned to its current version by adding pin = true to the plugin configuration. No further updates will e made to the package and avoids a known issue in an new release of that plugin.

Pin plugin true

  "nvim-treesitter/nvim-treesitter",
  pin = true,

The long term solution is to update nvim-treesitter-sexp to use the new kind-eq in its clojure query.

Only one occurance of has-type was found in the nvim-treesitter-sexp source code.

After forking the nvim-treesitter-sexp repository, the has-type line was changed to use kind-eq and the commit pushed to the fork.

The local clone of Practicall Asto Config was updated to use the fork and branch used for the change

Using Practicalli fork of nvim-treesitter-sexp

  {
    -- "PaterJason/nvim-treesitter-sexp",
    "practicalli-johnny/nvim-treesitter-sexp-fork",
    branch = "treesitter-has-type-to-kind-eq",
    -- commit = "",
    dependencies = { "nvim-treesitter/nvim-treesitter" },
    ft = { "clojure", "fennel", "janet", "query" },
    cmd = "TSSexp",
    opts = {},
  },

Disabling the AstroNvim Clojure pack in the lua/plugins/clojure.lua by commenting the import line and running a Lazy plugin manager update, Space p U or :Lazy update, removed the nvim-treesitter-sexp plugin and replaced it with the Practicalli fork.

With a few slurp and barf commands to test the simple change in the fork, it seems that change has fixed the error.

Once the maintainer has merged the PR (or come up with a more appropriate fix), then I can revert back to the AstroNvim Community Clojure pack and simplify my config a little.

GitHubλ︎

The GitHub keys page for an account lists all the authorisation and signing keys registered.

Each key shows its unique SHA, rather than the key value, for security reasons.

To identify if an SSH key is registered with GitHub, use the ssh-keygen command to show the SHA for public key file, *.pub.

Show SHA of public key with ssh-keygen

ssh-keygen -lf ~/.ssh/key-name.pub

Copy the SHA value generated by the ssh-keygen command and search for that value on the GitHub keys page.


Thank you.

🌐 Practical.li Website

Practical.li GitHub Org practicalli-johnny profile

@practicalli@clj.social @practical_li