updates
This commit is contained in:
@@ -15,9 +15,22 @@ return {
|
||||
require("shelbybark.plugins.codecompanion.fidget-spinner"):init()
|
||||
end,
|
||||
config = function()
|
||||
-- Store config in a module-level variable for later access
|
||||
local codecompanion_config = {
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "anthropic_haiku",
|
||||
},
|
||||
inline = {
|
||||
adapter = "anthropic_haiku",
|
||||
},
|
||||
},
|
||||
}
|
||||
_G.codecompanion_config = codecompanion_config
|
||||
|
||||
require("codecompanion").setup({
|
||||
ignore_warnings = true,
|
||||
strategies = {
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "anthropic_haiku",
|
||||
},
|
||||
@@ -107,14 +120,7 @@ return {
|
||||
|
||||
-- Create commands to show and change current model
|
||||
vim.api.nvim_create_user_command("CodeCompanionModel", function()
|
||||
local ok, codecompanion = pcall(require, "codecompanion")
|
||||
if not ok then
|
||||
vim.notify("CodeCompanion not available", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
-- Get current adapter info
|
||||
local current_adapter = codecompanion.config.strategies.chat.adapter
|
||||
local current_adapter = _G.codecompanion_config.strategies.chat.adapter
|
||||
local model_info = "Unknown"
|
||||
|
||||
if current_adapter == "anthropic" then
|
||||
@@ -150,8 +156,8 @@ return {
|
||||
end
|
||||
|
||||
-- Update the config
|
||||
require("codecompanion").config.strategies.chat.adapter = adapter
|
||||
require("codecompanion").config.strategies.inline.adapter = adapter
|
||||
_G.codecompanion_config.strategies.chat.adapter = adapter
|
||||
_G.codecompanion_config.strategies.inline.adapter = adapter
|
||||
|
||||
vim.notify(string.format("Switched to %s model", model), vim.log.levels.INFO)
|
||||
|
||||
|
||||
@@ -1,80 +1,70 @@
|
||||
-- Treesitter configuration for syntax highlighting and text objects
|
||||
-- Treesitter configuration for syntax highlighting
|
||||
-- Note: The new version of nvim-treesitter (post June 2023) dropped the module system.
|
||||
-- Highlighting is now handled by Neovim's native treesitter API.
|
||||
-- Text objects are handled by Neovim's native treesitter text objects (0.10+)
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
lazy = false,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.config").setup({
|
||||
ensure_installed = {
|
||||
"astro",
|
||||
"bash",
|
||||
"c",
|
||||
"css",
|
||||
"diff",
|
||||
"go",
|
||||
"gomod",
|
||||
"gowork",
|
||||
"gosum",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"jsonc",
|
||||
"json5",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
"ruby",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
-- Install parsers
|
||||
require("nvim-treesitter").install({
|
||||
"astro",
|
||||
"bash",
|
||||
"c",
|
||||
"css",
|
||||
"diff",
|
||||
"go",
|
||||
"gomod",
|
||||
"gowork",
|
||||
"gosum",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"jsonc",
|
||||
"json5",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
"ruby",
|
||||
})
|
||||
|
||||
-- Enable treesitter highlighting for supported filetypes
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function()
|
||||
local ok = pcall(vim.treesitter.start)
|
||||
if not ok then
|
||||
-- Parser not available for this filetype
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Enable treesitter-based indentation for supported filetypes
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function()
|
||||
local ok = pcall(function()
|
||||
vim.opt_local.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
||||
end)
|
||||
if not ok then
|
||||
-- Parser not available for this filetype
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -86,4 +76,3 @@ return {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user