updating libraries 💥
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
|
|
||||||
|
|||||||
@@ -303,8 +303,6 @@ function M.setup()
|
|||||||
|
|
||||||
-- Don't override vim.notify here to avoid circular dependency
|
-- Don't override vim.notify here to avoid circular dependency
|
||||||
-- Let the system handle notifications naturally
|
-- Let the system handle notifications naturally
|
||||||
|
|
||||||
print("Notification manager initialized")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize notification manager
|
-- Initialize notification manager
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
-- 0. Setup LuaRocks path for rest.nvim dependencies (Lua 5.1 - Neovim uses LuaJIT)
|
-- 0. Setup LuaRocks path for rest.nvim dependencies (Lua 5.1 - Neovim uses LuaJIT)
|
||||||
local function setup_luarocks_path()
|
local function setup_luarocks_path()
|
||||||
local luarocks_path = vim.fn.system("luarocks path --lr-path --lua-version=5.1 --local"):gsub("\n", "")
|
local luarocks_path = vim.fn.system("luarocks path --lr-path --lua-version=5.1 --local 2>/dev/null"):gsub("\n", "")
|
||||||
if luarocks_path and luarocks_path ~= "" then
|
if luarocks_path and luarocks_path ~= "" then
|
||||||
package.path = package.path .. ";" .. luarocks_path
|
package.path = package.path .. ";" .. luarocks_path
|
||||||
end
|
end
|
||||||
@@ -37,7 +37,7 @@ end
|
|||||||
vim.api.nvim_create_autocmd("BufRead", {
|
vim.api.nvim_create_autocmd("BufRead", {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd("filetype detect")
|
vim.cmd("silent filetype detect")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
-- -- Copilot Chat keymaps
|
-- Copilot keymaps
|
||||||
-- local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
--
|
|
||||||
-- keymap.set("v", "<leader>zn", ":CopilotChatRename<CR>", { desc = "Rename variable (Copilot Chat)" })
|
-- Copilot panel and status
|
||||||
-- keymap.set("n", "<leader>zc", ":CopilotChat<CR>", { desc = "Open Copilot Chat" })
|
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||||
-- keymap.set("v", "<leader>ze", ":CopilotChatExplain<CR>", { desc = "Explain code (Copilot Chat)" })
|
keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Copilot: Disable" })
|
||||||
-- keymap.set("v", "<leader>zr", ":CopilotChatReview<CR>", { desc = "Review code (Copilot Chat)" })
|
keymap.set("n", "<leader>ce", ":Copilot enable<CR>", { desc = "Copilot: Enable" })
|
||||||
-- keymap.set("v", "<leader>zf", ":CopilotChatFix<CR>", { desc = "Fix code issues (Copilot Chat)" })
|
keymap.set("n", "<leader>cs", ":Copilot status<CR>", { desc = "Copilot: Status" })
|
||||||
-- keymap.set("v", "<leader>zo", ":CopilotChatOptimize<CR>", { desc = "Optimize code (Copilot Chat)" })
|
|
||||||
-- keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (Copilot Chat)" })
|
-- Copilot suggestion navigation (insert mode)
|
||||||
-- keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
-- These are configured in copilot.lua but documented here for reference:
|
||||||
-- keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Copilot: Disabled" })
|
-- <leader>] - Next suggestion
|
||||||
-- keymap.set("n", "<leader>cs", ":Copilot status<CR>", { desc = "Copilot: Status" })
|
-- <leader>[ - Previous suggestion
|
||||||
|
-- <M-l> - Accept suggestion
|
||||||
|
-- <C-]> - Dismiss suggestion
|
||||||
|
|
||||||
|
-- CodeCompanion keymaps
|
||||||
|
keymap.set("n", "<leader>cc", ":CodeCompanion<CR>", { desc = "CodeCompanion: Open CodeCompanion" })
|
||||||
|
|||||||
@@ -90,3 +90,8 @@ keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (C
|
|||||||
-- Copilot
|
-- Copilot
|
||||||
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||||
keymap.set("n", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Copilot Chat: Explain code" })
|
keymap.set("n", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Copilot Chat: Explain code" })
|
||||||
|
|
||||||
|
-- Paste HTML as Markdown using pandoc
|
||||||
|
keymap.set("n", "<leader>p", function()
|
||||||
|
vim.cmd("read !pbpaste -Prefer html | pandoc -f html -t gfm")
|
||||||
|
end, { desc = "Paste HTML clipboard as Markdown" })
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
-- Core options and settings
|
-- Core options and settings
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
-- Disable deprecated API warnings
|
-- Disable deprecated API warnings
|
||||||
vim.deprecate = function() end
|
vim.deprecate = function() end
|
||||||
@@ -17,6 +18,10 @@ opt.completeopt = "menuone,noselect" -- Better completion
|
|||||||
opt.undofile = true -- Persistent undo
|
opt.undofile = true -- Persistent undo
|
||||||
opt.undodir = vim.fn.stdpath("data") .. "/undodir"
|
opt.undodir = vim.fn.stdpath("data") .. "/undodir"
|
||||||
|
|
||||||
|
-- Suppress startup messages to avoid "Press ENTER" prompts
|
||||||
|
opt.shortmess = "aoOtTIcFWS" -- Suppress various messages
|
||||||
|
opt.cmdheight = 1 -- Set command height to avoid prompts
|
||||||
|
|
||||||
-- Search settings
|
-- Search settings
|
||||||
opt.ignorecase = true -- Case insensitive search
|
opt.ignorecase = true -- Case insensitive search
|
||||||
opt.smartcase = true -- Case sensitive when uppercase
|
opt.smartcase = true -- Case sensitive when uppercase
|
||||||
@@ -130,18 +135,19 @@ g.loaded_perl_provider = 0 -- Disable Perl provider
|
|||||||
g.loaded_ruby_provider = 0 -- Disable Ruby provider (optional)
|
g.loaded_ruby_provider = 0 -- Disable Ruby provider (optional)
|
||||||
|
|
||||||
-- Python provider configuration
|
-- Python provider configuration
|
||||||
g.python3_host_prog = "/opt/homebrew/bin/python3.12" -- Explicit Python path
|
|
||||||
|
g.python3_host_prog = fn.expand("~/.local/pipx/venvs/pynvim/bin/python")
|
||||||
|
|
||||||
-- Clipboard provider optimization (macOS)
|
-- Clipboard provider optimization (macOS)
|
||||||
g.clipboard = {
|
g.clipboard = {
|
||||||
name = "xclip",
|
name = "macOS-clipboard",
|
||||||
copy = {
|
copy = {
|
||||||
["+"] = "xclip -selection clipboard",
|
["+"] = "pbcopy",
|
||||||
["*"] = "xclip -selection primary",
|
["*"] = "pbcopy",
|
||||||
},
|
},
|
||||||
paste = {
|
paste = {
|
||||||
["+"] = "xclip -selection clipboard -o",
|
["+"] = "pbpaste",
|
||||||
["*"] = "xclip -selection primary -o",
|
["*"] = "pbpaste",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,34 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"yetone/avante.nvim",
|
dir = "/Users/carlos/Documents/projects/avante.nvim",
|
||||||
|
-- "yetone/avante.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
version = false, -- Always pull the latest change
|
version = false, -- Always pull the latest change
|
||||||
|
build = "make", -- This will build on first load
|
||||||
opts = {
|
opts = {
|
||||||
provider = "claude", -- API provider configuration
|
provider = "cargdev", -- API provider configuration
|
||||||
|
mode = "agentic", -- Enable agentic mode for tool support
|
||||||
|
debug = true, -- Enable debug logging to troubleshoot tools
|
||||||
providers = {
|
providers = {
|
||||||
claude = {
|
cargdev = {
|
||||||
endpoint = "https://api.anthropic.com",
|
name = "cargdev", -- Optional
|
||||||
model = "claude-3-haiku-20240307",
|
endpoint = "http://localhost:5001", -- endpoint = "https://api-ai.cargdev.io", -- API endpoint
|
||||||
timeout = 30000, -- Timeout in milliseconds
|
api_key_name = "CARGDEV_API_KEY", -- reference the ENV VAR below
|
||||||
extra_request_body = {
|
model = "qwen2.5-coder:7b",
|
||||||
temperature = 0.75,
|
__inherited_from = "ollama", -- ensures compatibility
|
||||||
max_tokens = 4096,
|
max_tokens = 8192,
|
||||||
|
-- Explicitly ensure tools are enabled
|
||||||
|
disable_tools = false,
|
||||||
|
-- Tool format: false = function calling (JSON tools in request), true = XML tool format (tools in prompt)
|
||||||
|
use_ReAct_prompt = false, -- Use function calling format (OpenAI-compatible)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
-- Build from source for development
|
||||||
-- Optional: Build from source if required
|
-- Run `make BUILD_FROM_SOURCE=true` to build Rust components
|
||||||
build = "make",
|
-- You can also build manually: cd /Users/carlos/Documents/projects/avante.nvim && make
|
||||||
|
build = "make BUILD_FROM_SOURCE=true",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
@@ -32,14 +41,31 @@ return {
|
|||||||
{
|
{
|
||||||
"folke/snacks.nvim", -- for input provider snacks
|
"folke/snacks.nvim", -- for input provider snacks
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1001, -- Higher than dressing to override it
|
||||||
|
dependencies = {
|
||||||
|
"stevearc/dressing.nvim", -- Load after dressing to override it
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("snacks").setup({
|
require("snacks").setup({
|
||||||
-- Enable all snacks modules
|
-- Enable all snacks modules
|
||||||
bigfile = { enabled = true },
|
bigfile = { enabled = true },
|
||||||
dashboard = { enabled = true },
|
dashboard = {
|
||||||
|
enabled = true,
|
||||||
|
autostart = true,
|
||||||
|
-- Ensure dashboard setup runs
|
||||||
|
auto_open = false,
|
||||||
|
},
|
||||||
explorer = { enabled = true },
|
explorer = { enabled = true },
|
||||||
image = { enabled = true },
|
image = {
|
||||||
|
enabled = true,
|
||||||
|
-- Auto-detect terminal (will try: kitty, wezterm, ghostty in order)
|
||||||
|
-- If none found, image rendering will be disabled with warnings
|
||||||
|
-- Note: LaTeX and Mermaid features require external tools:
|
||||||
|
-- - LaTeX: tectonic or pdflatex
|
||||||
|
-- - Mermaid: mmdc (Mermaid CLI)
|
||||||
|
-- These warnings are informational and won't prevent basic image rendering
|
||||||
|
terminal = nil, -- nil = auto-detect
|
||||||
|
},
|
||||||
input = { enabled = true },
|
input = { enabled = true },
|
||||||
lazygit = { enabled = true },
|
lazygit = { enabled = true },
|
||||||
notifier = { enabled = true },
|
notifier = { enabled = true },
|
||||||
@@ -57,9 +83,24 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Force dashboard module initialization
|
||||||
|
-- Access the dashboard module to ensure its setup function runs
|
||||||
|
vim.defer_fn(function()
|
||||||
|
pcall(function()
|
||||||
|
local dashboard = require("snacks.dashboard")
|
||||||
|
-- Access the module to trigger lazy initialization if needed
|
||||||
|
if dashboard and type(dashboard) == "table" then
|
||||||
|
-- Module loaded successfully
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end, 100)
|
||||||
|
|
||||||
-- Set up vim.ui.input and vim.ui.select for snacks
|
-- Set up vim.ui.input and vim.ui.select for snacks
|
||||||
|
-- Use vim.schedule to ensure this runs after all plugins are loaded
|
||||||
|
vim.schedule(function()
|
||||||
vim.ui.input = require("snacks.input").input
|
vim.ui.input = require("snacks.input").input
|
||||||
vim.ui.select = require("snacks.picker").select
|
vim.ui.select = require("snacks.picker").select
|
||||||
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
|
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
|
||||||
@@ -85,6 +126,15 @@ return {
|
|||||||
require("render-markdown").setup({
|
require("render-markdown").setup({
|
||||||
file_types = { "markdown", "Avante" },
|
file_types = { "markdown", "Avante" },
|
||||||
latex = { enabled = false }, -- Disable latex to avoid warning
|
latex = { enabled = false }, -- Disable latex to avoid warning
|
||||||
|
html = { enabled = false }, -- Disable html support to avoid warnings
|
||||||
|
yaml = { enabled = false }, -- Disable yaml support to avoid warnings
|
||||||
|
})
|
||||||
|
-- Enable treesitter highlighter for markdown buffers
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "markdown", "Avante" },
|
||||||
|
callback = function()
|
||||||
|
vim.treesitter.start()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
84
lua/cargdev/plugins/copilot.lua
Normal file
84
lua/cargdev/plugins/copilot.lua
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
cmd = "Copilot",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
require("copilot").setup({
|
||||||
|
panel = {
|
||||||
|
enabled = true,
|
||||||
|
auto_refresh = false,
|
||||||
|
keymap = {
|
||||||
|
jump_prev = "[[",
|
||||||
|
jump_next = "]]",
|
||||||
|
accept = "<CR>",
|
||||||
|
refresh = "gr",
|
||||||
|
open = "<M-CR>",
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
position = "bottom", -- | top | left | right
|
||||||
|
ratio = 0.4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
suggestion = {
|
||||||
|
enabled = true,
|
||||||
|
auto_trigger = true, -- Enable auto-trigger suggestions as you type
|
||||||
|
debounce = 75,
|
||||||
|
keymap = {
|
||||||
|
accept = "<M-l>",
|
||||||
|
accept_word = false,
|
||||||
|
accept_line = false,
|
||||||
|
next = "<leader>]", -- Use leader key for next suggestion
|
||||||
|
prev = "<leader>[", -- Use leader key for previous suggestion
|
||||||
|
dismiss = "<C-]>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
markdown = true,
|
||||||
|
help = true,
|
||||||
|
gitcommit = true,
|
||||||
|
gitrebase = true,
|
||||||
|
hgcommit = true,
|
||||||
|
svn = true,
|
||||||
|
cvs = true,
|
||||||
|
["."] = true,
|
||||||
|
},
|
||||||
|
copilot_node_command = "node", -- Node.js version must be > 16.x
|
||||||
|
server_opts_overrides = {},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot-cmp",
|
||||||
|
dependencies = { "zbirenbaum/copilot.lua" },
|
||||||
|
config = function()
|
||||||
|
require("copilot_cmp").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"olimorris/codecompanion.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
},
|
||||||
|
cmd = { "CodeCompanion" },
|
||||||
|
config = function()
|
||||||
|
require("codecompanion").setup({
|
||||||
|
-- Use GitHub Copilot as the provider
|
||||||
|
providers = {
|
||||||
|
copilot = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Configure the UI
|
||||||
|
ui = {
|
||||||
|
window = {
|
||||||
|
width = 0.8,
|
||||||
|
height = 0.8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
return {
|
return {
|
||||||
"CarGDev/rest.nvim",
|
"CarGDev/rest.nvim",
|
||||||
|
build = function()
|
||||||
|
-- Install LuaRocks dependencies for Lua 5.1 (Neovim uses LuaJIT which is Lua 5.1 compatible)
|
||||||
|
local packages = { "mimetypes", "xml2lua" }
|
||||||
|
for _, pkg in ipairs(packages) do
|
||||||
|
local result = vim.fn.system("luarocks install --local --lua-version=5.1 " .. pkg .. " 2>&1")
|
||||||
|
if vim.v.shell_error ~= 0 and not result:match("already installed") then
|
||||||
|
vim.notify("Warning: Failed to install " .. pkg .. ": " .. result, vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
@@ -8,6 +18,26 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
-- Verify LuaRocks dependencies are available
|
||||||
|
local function check_dependency(name)
|
||||||
|
local success = pcall(require, name)
|
||||||
|
if not success then
|
||||||
|
vim.notify(
|
||||||
|
string.format(
|
||||||
|
"rest.nvim: Missing dependency '%s'. Please run: luarocks install --local %s",
|
||||||
|
name,
|
||||||
|
name
|
||||||
|
),
|
||||||
|
vim.log.levels.WARN
|
||||||
|
)
|
||||||
|
end
|
||||||
|
return success
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for required dependencies
|
||||||
|
check_dependency("mimetypes")
|
||||||
|
check_dependency("xml2lua")
|
||||||
|
|
||||||
-- Basic configuration for rest.nvim
|
-- Basic configuration for rest.nvim
|
||||||
vim.g.rest_nvim = {
|
vim.g.rest_nvim = {
|
||||||
-- Enable request highlighting
|
-- Enable request highlighting
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ return {
|
|||||||
"pyright",
|
"pyright",
|
||||||
"svelte",
|
"svelte",
|
||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
|
"ts_ls",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -127,7 +128,9 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emmet_ls = {},
|
emmet_ls = {
|
||||||
|
filetypes = { "html", "css", "sass", "scss", "less", "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" },
|
||||||
|
},
|
||||||
eslint = {
|
eslint = {
|
||||||
settings = { workingDirectory = { mode = "auto" } }
|
settings = { workingDirectory = { mode = "auto" } }
|
||||||
},
|
},
|
||||||
@@ -140,8 +143,12 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
graphql = {},
|
graphql = {
|
||||||
html = {},
|
filetypes = { "graphql", "gql", "typescript", "javascript", "typescriptreact", "javascriptreact" },
|
||||||
|
},
|
||||||
|
html = {
|
||||||
|
filetypes = { "html" },
|
||||||
|
},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
@@ -155,7 +162,9 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
prismals = {},
|
prismals = {
|
||||||
|
filetypes = { "prisma" },
|
||||||
|
},
|
||||||
pyright = {
|
pyright = {
|
||||||
settings = {
|
settings = {
|
||||||
python = {
|
python = {
|
||||||
@@ -166,17 +175,59 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
svelte = {},
|
svelte = {
|
||||||
tailwindcss = {},
|
filetypes = { "svelte" },
|
||||||
|
},
|
||||||
|
tailwindcss = {
|
||||||
|
filetypes = { "html", "css", "sass", "scss", "less", "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" },
|
||||||
|
init_options = {
|
||||||
|
userLanguages = {
|
||||||
|
html = "html",
|
||||||
|
css = "css",
|
||||||
|
javascript = "javascript",
|
||||||
|
typescript = "typescript",
|
||||||
|
javascriptreact = "javascriptreact",
|
||||||
|
typescriptreact = "typescriptreact",
|
||||||
|
vue = "vue",
|
||||||
|
svelte = "svelte",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ts_ls = {
|
||||||
|
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
includeInlayPropertyDeclarationTypeHints = true,
|
||||||
|
includeInlayFunctionLikeReturnTypeHints = true,
|
||||||
|
includeInlayEnumMemberValueHints = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
javascript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
includeInlayPropertyDeclarationTypeHints = true,
|
||||||
|
includeInlayFunctionLikeReturnTypeHints = true,
|
||||||
|
includeInlayEnumMemberValueHints = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
-- sqls = { settings = { sqls = { connections = { /* …your dbs… */ } } } }, -- optional
|
-- sqls = { settings = { sqls = { connections = { /* …your dbs… */ } } } }, -- optional
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Set up all LSP servers with performance optimizations and error handling
|
-- Set up all LSP servers with performance optimizations and error handling
|
||||||
for name, cfg in pairs(servers) do
|
for name, cfg in pairs(servers) do
|
||||||
lspconfig[name].setup({
|
local server_config = {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = cfg.settings,
|
|
||||||
flags = { debounce_text_changes = 150 },
|
flags = { debounce_text_changes = 150 },
|
||||||
handlers = {
|
handlers = {
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
@@ -184,7 +235,24 @@ return {
|
|||||||
{ virtual_text = false, signs = true, underline = true, update_in_insert = false }
|
{ virtual_text = false, signs = true, underline = true, update_in_insert = false }
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
|
-- Add settings if present
|
||||||
|
if cfg.settings then
|
||||||
|
server_config.settings = cfg.settings
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add filetypes if present
|
||||||
|
if cfg.filetypes then
|
||||||
|
server_config.filetypes = cfg.filetypes
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add init_options if present
|
||||||
|
if cfg.init_options then
|
||||||
|
server_config.init_options = cfg.init_options
|
||||||
|
end
|
||||||
|
|
||||||
|
lspconfig[name].setup(server_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set up additional LSP servers that might not be in mason-lspconfig
|
-- Set up additional LSP servers that might not be in mason-lspconfig
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ return {
|
|||||||
"black", -- python formatter
|
"black", -- python formatter
|
||||||
"pylint",
|
"pylint",
|
||||||
"eslint_d",
|
"eslint_d",
|
||||||
|
"tree-sitter-cli", -- required for nvim-treesitter parser compilation
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -47,10 +47,42 @@ return {
|
|||||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||||
|
-- Tab to accept Copilot suggestions, fallback to snippet expansion
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
local entry = cmp.get_selected_entry()
|
||||||
|
-- If Copilot suggestion is available and selected, accept it
|
||||||
|
if entry and entry.source.name == "copilot" then
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
else
|
||||||
|
-- Check if we can find a Copilot entry in the completion menu
|
||||||
|
-- Since Copilot has high priority (900), it's likely near the top
|
||||||
|
-- Just confirm the current selection (Copilot will be selected if available)
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
end
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
-- Expand snippet or jump to next placeholder
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
-- Fallback to default Tab behavior
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
-- Shift-Tab to go back in snippets
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
}),
|
}),
|
||||||
-- sources for autocompletion
|
-- sources for autocompletion
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp", priority = 1000},
|
{ name = "nvim_lsp", priority = 1000},
|
||||||
|
{ name = "copilot", priority = 900 }, -- GitHub Copilot suggestions
|
||||||
{ name = "luasnip", priority = 750 }, -- snippets
|
{ name = "luasnip", priority = 750 }, -- snippets
|
||||||
{ name = "buffer", priority = 500, keyword_length = 3 }, -- text within current buffer
|
{ name = "buffer", priority = 500, keyword_length = 3 }, -- text within current buffer
|
||||||
{ name = "path", priority = 250 }, -- file system paths
|
{ name = "path", priority = 250 }, -- file system paths
|
||||||
|
|||||||
@@ -1,24 +1,10 @@
|
|||||||
return {
|
return {
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
build = ":TSUpdate",
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {
|
|
||||||
"lua",
|
|
||||||
"html", -- required by leetcode.nvim
|
|
||||||
"python",
|
|
||||||
"javascript",
|
|
||||||
"typescript",
|
|
||||||
"cpp",
|
|
||||||
},
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
textobjects = {
|
textobjects = {
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = { "BufReadPost", "BufNewFile" }, -- Changed from BufReadPre to BufReadPost for better performance
|
event = { "BufReadPost", "BufNewFile" }, -- Changed from BufReadPre to BufReadPost for better performance
|
||||||
build = ":TSUpdate",
|
build = function()
|
||||||
|
-- Install tree-sitter-cli if not available, then update parsers
|
||||||
|
if vim.fn.executable("tree-sitter") == 0 then
|
||||||
|
vim.notify("tree-sitter-cli not found. Please install it: npm install -g tree-sitter-cli", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
vim.cmd("TSUpdate")
|
||||||
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"windwp/nvim-ts-autotag",
|
"windwp/nvim-ts-autotag",
|
||||||
},
|
},
|
||||||
config = function()
|
opts = {
|
||||||
-- import nvim-treesitter plugin
|
-- enable syntax highlighting
|
||||||
local treesitter = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
-- configure treesitter
|
|
||||||
treesitter.setup({ -- enable syntax highlighting
|
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
@@ -37,10 +39,12 @@ return {
|
|||||||
"yaml",
|
"yaml",
|
||||||
"html",
|
"html",
|
||||||
"css",
|
"css",
|
||||||
|
"scss",
|
||||||
"prisma",
|
"prisma",
|
||||||
"markdown",
|
"markdown",
|
||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
"svelte",
|
"svelte",
|
||||||
|
"vue",
|
||||||
"graphql",
|
"graphql",
|
||||||
"sql",
|
"sql",
|
||||||
"bash",
|
"bash",
|
||||||
@@ -51,6 +55,11 @@ return {
|
|||||||
"query",
|
"query",
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
"c",
|
"c",
|
||||||
|
"python",
|
||||||
|
"cpp",
|
||||||
|
"latex",
|
||||||
|
"norg",
|
||||||
|
"typst",
|
||||||
},
|
},
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -68,6 +77,5 @@ return {
|
|||||||
query_linter = {
|
query_linter = {
|
||||||
enable = false, -- Disable query linter for better performance
|
enable = false, -- Disable query linter for better performance
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user