updates
This commit is contained in:
@@ -5,6 +5,10 @@ return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
-- Optional: for enhanced diagnostics/context
|
||||
"georgeharker/mcp-diagnostics.nvim",
|
||||
-- For progress notifications
|
||||
"j-hui/fidget.nvim",
|
||||
-- For statusline integration
|
||||
"nvim-lualine/lualine.nvim",
|
||||
},
|
||||
event = "VeryLazy", -- Lazy load the plugin
|
||||
config = function()
|
||||
@@ -40,6 +44,13 @@ return {
|
||||
window = {
|
||||
layout = "vertical", -- or "horizontal", "float"
|
||||
},
|
||||
show_progress = true,
|
||||
show_token_count = true,
|
||||
},
|
||||
-- Progress notifications using fidget
|
||||
progress = {
|
||||
enabled = true,
|
||||
provider = "fidget",
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -59,5 +70,7 @@ return {
|
||||
)
|
||||
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("v", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
|
||||
|
||||
|
||||
end,
|
||||
}
|
||||
|
||||
95
lua/shelbybark/plugins/fidget.lua
Normal file
95
lua/shelbybark/plugins/fidget.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
"j-hui/fidget.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- Options related to LSP progress subsystem
|
||||
progress = {
|
||||
poll_rate = 0, -- How and when to poll for progress messages
|
||||
suppress_on_insert = false, -- Suppress new messages while in insert mode
|
||||
ignore_done_already = false, -- Ignore new tasks that are already complete
|
||||
ignore_empty_message = false, -- Ignore new tasks that don't contain a message
|
||||
clear_on_detach = function(client_id)
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
return client and client.name or nil
|
||||
end,
|
||||
notification = {
|
||||
poll_rate = 10, -- How frequently to update and render the progress notifications
|
||||
filter = vim.log.levels.INFO, -- Minimum notifications level
|
||||
history_size = 128, -- Number of removed messages to retain in history
|
||||
override_vim_notify = false, -- Automatically override vim.notify() with Fidget
|
||||
configs = { -- How to configure notification groups when instantiated
|
||||
default = require("fidget.notification").default_config,
|
||||
},
|
||||
redirect = function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
|
||||
end
|
||||
end,
|
||||
view = {
|
||||
stack_upwards = true, -- Display notification items from bottom to top
|
||||
icon_separator = " ", -- Separator between group name and icon
|
||||
group_separator = "---", -- Separator between notification groups
|
||||
group_separator_hl = "Comment", -- Highlight group used for group separator
|
||||
render_message = function(msg, cnt)
|
||||
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
|
||||
end,
|
||||
},
|
||||
},
|
||||
lsp = {
|
||||
progress_ringbuf_size = 0, -- Configure the nvim's LSP progress ring buffer size
|
||||
},
|
||||
},
|
||||
-- Options related to notification subsystem
|
||||
notification = {
|
||||
poll_rate = 10, -- How frequently to update and render the notification window
|
||||
filter = vim.log.levels.INFO, -- Minimum notifications level
|
||||
history_size = 128, -- Number of removed messages to retain in history
|
||||
override_vim_notify = false, -- Automatically override vim.notify() with Fidget
|
||||
configs = { -- How to configure notification groups when instantiated
|
||||
default = require("fidget.notification").default_config,
|
||||
},
|
||||
redirect = function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
|
||||
end
|
||||
end,
|
||||
view = {
|
||||
stack_upwards = true, -- Display notification items from bottom to top
|
||||
icon_separator = " ", -- Separator between group name and icon
|
||||
group_separator = "---", -- Separator between notification groups
|
||||
group_separator_hl = "Comment", -- Highlight group used for group separator
|
||||
render_message = function(msg, cnt)
|
||||
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
normal_hl = "Comment", -- Base highlight group in the notification window
|
||||
winblend = 100, -- Background color opacity in the notification window
|
||||
border = "none", -- Border around the notification window
|
||||
zindex = 45, -- Stacking priority of the notification window
|
||||
max_width = 0, -- Maximum width of the notification window
|
||||
max_height = 0, -- Maximum height of the notification window
|
||||
x_padding = 1, -- Padding from right edge of window boundary
|
||||
y_padding = 0, -- Padding from bottom edge of window boundary
|
||||
align = "bottom", -- How to align the notification window
|
||||
relative = "editor", -- What the notification window position is relative to
|
||||
},
|
||||
},
|
||||
-- Options related to integrating with other plugins
|
||||
integration = {
|
||||
["nvim-tree"] = {
|
||||
enable = true, -- Integrate with nvim-tree/nvim-tree.lua (if available)
|
||||
},
|
||||
["xcodebuild-nvim"] = {
|
||||
enable = true, -- Integrate with wojciech-kulik/xcodebuild.nvim (if available)
|
||||
},
|
||||
},
|
||||
-- Options related to logging
|
||||
logger = {
|
||||
level = vim.log.levels.WARN, -- Minimum logging level
|
||||
max_size = 10000, -- Maximum log file size, in KB
|
||||
float_precision = 0.01, -- Limit the number of decimals displayed for floats
|
||||
path = string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache")), -- Where Fidget writes its logs to
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -5,6 +5,21 @@ return {
|
||||
local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
|
||||
-- CodeCompanion status function
|
||||
local function codecompanion_status()
|
||||
local ok, codecompanion = pcall(require, "codecompanion")
|
||||
if not ok then
|
||||
return ""
|
||||
end
|
||||
|
||||
local status = codecompanion.status()
|
||||
if status and status ~= "" then
|
||||
return "🤖 " .. status
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
@@ -14,6 +29,7 @@ return {
|
||||
fg = "#c3ccdc",
|
||||
bg = "#112638",
|
||||
inactive_bg = "#2c3043",
|
||||
semilightgray = "#6b7280",
|
||||
}
|
||||
|
||||
local my_lualine_theme = {
|
||||
@@ -59,6 +75,10 @@ return {
|
||||
},
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{
|
||||
codecompanion_status,
|
||||
color = { fg = colors.green },
|
||||
},
|
||||
{
|
||||
lazy_status.updates,
|
||||
cond = lazy_status.has_updates,
|
||||
|
||||
@@ -4,143 +4,84 @@ return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
event = "BufRead",
|
||||
branch = "main",
|
||||
priority = 1000,
|
||||
build = ":TSUpdate",
|
||||
---@class TSConfig
|
||||
opts = {
|
||||
-- custom handling of parsers
|
||||
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",
|
||||
},
|
||||
-- Add standard treesitter configuration
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- Set up standard treesitter (this handles ensure_installed automatically)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
|
||||
-- Register parsers for filetypes (if needed for custom mappings)
|
||||
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||
-- register and start parsers for filetypes
|
||||
for _, parser in ipairs(opts.ensure_installed) do
|
||||
local filetypes = parser -- In this case, parser is the filetype/language name
|
||||
vim.treesitter.language.register(parser, filetypes)
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = filetypes,
|
||||
callback = function(event)
|
||||
local ok, _ = pcall(vim.treesitter.start, event.buf, parser)
|
||||
if not ok then
|
||||
-- Silently fail if parser issues
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
config = function()
|
||||
local ok, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
if not ok then
|
||||
vim.notify("nvim-treesitter.configs not available", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
-- Auto-install and start parsers for any buffer
|
||||
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
||||
callback = function(event)
|
||||
local bufnr = event.buf
|
||||
local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
|
||||
|
||||
-- Skip if no filetype
|
||||
if filetype == "" then
|
||||
return
|
||||
end
|
||||
|
||||
-- Check if this filetype is already handled by explicit opts.ensure_installed config
|
||||
for _, filetypes in pairs(opts.ensure_installed) do
|
||||
local ft_table = type(filetypes) == "table" and filetypes or { filetypes }
|
||||
if vim.tbl_contains(ft_table, filetype) then
|
||||
return -- Already handled above
|
||||
end
|
||||
end
|
||||
|
||||
-- Get parser name based on filetype
|
||||
local parser_name = vim.treesitter.language.get_lang(filetype) -- might return filetype (not helpful)
|
||||
if not parser_name then
|
||||
return
|
||||
end
|
||||
-- Try to get existing parser (helpful check if filetype was returned above)
|
||||
local parser_configs = require("nvim-treesitter.parsers")
|
||||
if not parser_configs[parser_name] then
|
||||
return -- Parser not available, skip silently
|
||||
end
|
||||
|
||||
local parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
|
||||
|
||||
if not parser_installed then
|
||||
-- If not installed, install parser synchronously
|
||||
local ok, _ = pcall(function()
|
||||
require("nvim-treesitter.install").install(parser_name)
|
||||
end)
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- let's check again
|
||||
parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
|
||||
|
||||
if parser_installed then
|
||||
-- Start treesitter for this buffer
|
||||
pcall(vim.treesitter.start, bufnr, parser_name)
|
||||
end
|
||||
end,
|
||||
|
||||
treesitter.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>",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
event = "BufRead",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
event = "BufReadPre",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {
|
||||
multiwindow = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
branch = "main",
|
||||
event = "BufReadPre",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
keys = {
|
||||
{
|
||||
@@ -175,16 +116,6 @@ return {
|
||||
desc = "Select inner class",
|
||||
mode = { "x", "o" },
|
||||
},
|
||||
{
|
||||
"as",
|
||||
function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@local.scope", "locals")
|
||||
end,
|
||||
desc = "Select local scope",
|
||||
mode = { "x", "o" },
|
||||
},
|
||||
},
|
||||
---@module "nvim-treesitter-textobjects"
|
||||
opts = { multiwindow = true },
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user