From 2351d799a7272c22f3a273dd780b09e5b9869082 Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Mon, 26 Jan 2026 17:09:02 +0000 Subject: [PATCH] opencode plan --- profiles/neovim/plugins/treesitter.nix | 42 ++++++++++++++++++++++---- profiles/opencode.nix | 3 ++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/profiles/neovim/plugins/treesitter.nix b/profiles/neovim/plugins/treesitter.nix index 083356b..f9220d8 100644 --- a/profiles/neovim/plugins/treesitter.nix +++ b/profiles/neovim/plugins/treesitter.nix @@ -1,10 +1,40 @@ {pkgs, ...}: { - programs.nixvim.plugins.treesitter = { - enable = true; - settings = { - highlight.enable = true; - indent.enable = true; + programs.nixvim = { + plugins.treesitter = { + enable = true; + nixGrammars = true; + grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars; + settings = { + highlight.enable = true; + indent.enable = true; + }; }; - grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars; + + # Register missing treesitter predicates for compatibility with newer grammars + extraConfigLuaPre = '' + do + local query = require("vim.treesitter.query") + local predicates = query.list_predicates() + if not vim.tbl_contains(predicates, "is-not?") then + query.add_predicate("is-not?", function(match, pattern, source, predicate) + local dominated_by = predicate[2] + local dominated = false + for _, node in pairs(match) do + if type(node) == "userdata" then + local current = node:parent() + while current do + if current:type() == dominated_by then + dominated = true + break + end + current = current:parent() + end + end + end + return not dominated + end, { force = true, all = true }) + end + end + ''; }; } diff --git a/profiles/opencode.nix b/profiles/opencode.nix index be72ab6..d7a2c89 100644 --- a/profiles/opencode.nix +++ b/profiles/opencode.nix @@ -3,6 +3,9 @@ pkgs, ... }: { + home.sessionVariables = { + OPENCODE_EXPERIMENTAL_PLAN_MODE = 1; + }; programs.opencode = { enable = true; package = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.opencode;