updates
This commit is contained in:
parent
9bae49fa30
commit
e216dc057c
10
init.lua
10
init.lua
@ -7,6 +7,10 @@ require("utils.telescope_extra").setup()
|
|||||||
require("utils.git_paste").setup({
|
require("utils.git_paste").setup({
|
||||||
telescope_key = "<leader>pg",
|
telescope_key = "<leader>pg",
|
||||||
})
|
})
|
||||||
vim.filetype.add({
|
require("utils.treesitter.parsers.hyprlang")
|
||||||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
require("utils.hyprland.lsp")
|
||||||
})
|
-- vim.notify = function(msg, level, opts)
|
||||||
|
-- print("Notification debug:", msg, level, vim.inspect(opts))
|
||||||
|
-- -- Call original notify
|
||||||
|
-- require("notify")(msg, level, opts)
|
||||||
|
-- end
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
|
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "bf18d4dc8d9a7a61e855190bc154df12d6536741" },
|
"nvim-treesitter": { "branch": "master", "commit": "4cf2da5c3a2dfd22e72713c66203d21883b149fd" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
||||||
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
|
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
|
||||||
"odis": { "branch": "master", "commit": "5176a07a729860d0c0cdefe96252fc7ff9e16d43" },
|
"odis": { "branch": "master", "commit": "5176a07a729860d0c0cdefe96252fc7ff9e16d43" },
|
||||||
|
@ -74,17 +74,3 @@ vim.api.nvim_create_autocmd({ "User" }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Hyprlang LSP
|
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|
||||||
pattern = { "*.hl", "hypr*.conf" },
|
|
||||||
callback = function(event)
|
|
||||||
print(string.format("starting hyprls for %s", vim.inspect(event)))
|
|
||||||
vim.lsp.start({
|
|
||||||
name = "hyprlang",
|
|
||||||
cmd = { "hyprls" },
|
|
||||||
root_dir = vim.fn.getcwd(),
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
--}}}
|
|
||||||
|
@ -29,6 +29,20 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
llama_cpp = function()
|
||||||
|
return require("codecompanion.adapters").extend("openai_compatible", {
|
||||||
|
name = "llama-cpp",
|
||||||
|
schema = {
|
||||||
|
model = {
|
||||||
|
default = "qwen2.5-coder-14b-instruct",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
env = {
|
||||||
|
url = "http://localhost:8888",
|
||||||
|
chat_url = "/v1/chat/completions",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
strategies = {
|
strategies = {
|
||||||
chat = {
|
chat = {
|
||||||
|
@ -48,7 +48,7 @@ function M:pop_progress_handle(id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M:create_progress_handle(request)
|
function M:create_progress_handle(request)
|
||||||
local title = " Requesting assistance"
|
local title = " Requesting assistance"
|
||||||
.. " ("
|
.. " ("
|
||||||
.. request.data.strategy
|
.. request.data.strategy
|
||||||
.. ") from "
|
.. ") from "
|
||||||
@ -56,7 +56,9 @@ function M:create_progress_handle(request)
|
|||||||
.. " using "
|
.. " using "
|
||||||
.. request.data.adapter.model
|
.. request.data.adapter.model
|
||||||
local idx = 1
|
local idx = 1
|
||||||
local notification_id = notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
local start_time = os.time()
|
||||||
|
local notification_id =
|
||||||
|
notify(spinner_frames[idx] .. " In progress (" .. "0s" .. ")...", "info", { title = title, timeout = false })
|
||||||
local handle = { notification_id = notification_id, title = title, finished = false }
|
local handle = { notification_id = notification_id, title = title, finished = false }
|
||||||
local timer = vim.loop.new_timer()
|
local timer = vim.loop.new_timer()
|
||||||
timer:start(
|
timer:start(
|
||||||
@ -67,13 +69,17 @@ function M:create_progress_handle(request)
|
|||||||
return
|
return
|
||||||
end -- stop updating if finished
|
end -- stop updating if finished
|
||||||
idx = idx % spinner_len + 1
|
idx = idx % spinner_len + 1
|
||||||
|
local elapsed = os.difftime(os.time(), start_time)
|
||||||
local opts = { replace = handle.notification_id, title = title, timeout = false }
|
local opts = { replace = handle.notification_id, title = title, timeout = false }
|
||||||
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress...", "info", opts)
|
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...", "info", opts)
|
||||||
if ok then
|
if ok then
|
||||||
handle.notification_id = new_id
|
handle.notification_id = new_id
|
||||||
else
|
else
|
||||||
handle.notification_id =
|
handle.notification_id = notify(
|
||||||
notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...",
|
||||||
|
"info",
|
||||||
|
{ title = title, timeout = false }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ return {
|
|||||||
"bashls",
|
"bashls",
|
||||||
"jedi_language_server",
|
"jedi_language_server",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
"yamlls",
|
-- "yamlls",
|
||||||
"vimls",
|
"vimls",
|
||||||
"dotls",
|
"dotls",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
@ -18,6 +18,7 @@ return {
|
|||||||
"ts_ls",
|
"ts_ls",
|
||||||
"angularls",
|
"angularls",
|
||||||
"ansiblels",
|
"ansiblels",
|
||||||
|
"docker_compose_language_service",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
@ -65,6 +66,13 @@ return {
|
|||||||
Lua = {},
|
Lua = {},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
elseif lsp == "docker_compose_language_service" then
|
||||||
|
lspconfig[lsp].setup({
|
||||||
|
filetypes = { "dockerfile", "docker-compose", "yaml", "yml" },
|
||||||
|
on_attach = function()
|
||||||
|
vim.notify("Docker Compose LSP attached", nil, { title = "LSP" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
else
|
else
|
||||||
lspconfig[lsp].setup({
|
lspconfig[lsp].setup({
|
||||||
on_attach = function()
|
on_attach = function()
|
||||||
|
102
lua/utils/hyprland/lsp/init.lua
Normal file
102
lua/utils/hyprland/lsp/init.lua
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
vim.notify = require("notify")
|
||||||
|
|
||||||
|
local client_notifs = {}
|
||||||
|
|
||||||
|
local function get_notif_data(client_id, token)
|
||||||
|
if not client_notifs[client_id] then
|
||||||
|
client_notifs[client_id] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
if not client_notifs[client_id][token] then
|
||||||
|
client_notifs[client_id][token] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
return client_notifs[client_id][token]
|
||||||
|
end
|
||||||
|
|
||||||
|
local spinner_frames = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }
|
||||||
|
|
||||||
|
local function update_spinner(client_id, token)
|
||||||
|
local notif_data = get_notif_data(client_id, token)
|
||||||
|
|
||||||
|
if notif_data.spinner then
|
||||||
|
local new_spinner = (notif_data.spinner + 1) % #spinner_frames
|
||||||
|
notif_data.spinner = new_spinner
|
||||||
|
|
||||||
|
notif_data.notification = vim.notify("", nil, {
|
||||||
|
hide_from_history = true,
|
||||||
|
icon = spinner_frames[new_spinner],
|
||||||
|
replace = notif_data.notification,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.defer_fn(function()
|
||||||
|
update_spinner(client_id, token)
|
||||||
|
end, 100)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function format_title(title, client_name)
|
||||||
|
return client_name .. (#title > 0 and ": " .. title or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function format_message(message, percentage)
|
||||||
|
return (percentage and percentage .. "%\t" or "") .. (message or "")
|
||||||
|
end
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
|
pattern = { "*.hl", "hypr*.conf" },
|
||||||
|
callback = function(event)
|
||||||
|
-- print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||||
|
vim.lsp.start({
|
||||||
|
name = "hyprlang",
|
||||||
|
cmd = { "hyprls" },
|
||||||
|
root_dir = vim.fn.getcwd(),
|
||||||
|
on_attach = function()
|
||||||
|
vim.notify("Hyprlang LSP attached", "info")
|
||||||
|
end,
|
||||||
|
on_init = function()
|
||||||
|
vim.notify("Hyprlang LSP initialized", "info")
|
||||||
|
end,
|
||||||
|
handlers = {
|
||||||
|
["$/progress"] = function(_, result, ctx)
|
||||||
|
local client_id = ctx.client_id
|
||||||
|
|
||||||
|
local val = result.value
|
||||||
|
|
||||||
|
if not val.kind then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local notif_data = get_notif_data(client_id, result.token)
|
||||||
|
|
||||||
|
if val.kind == "begin" then
|
||||||
|
local message = format_message(val.message, val.percentage)
|
||||||
|
|
||||||
|
notif_data.notification = vim.notify(message, "info", {
|
||||||
|
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
|
||||||
|
icon = spinner_frames[1],
|
||||||
|
timeout = false,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
notif_data.spinner = 1
|
||||||
|
update_spinner(client_id, result.token)
|
||||||
|
elseif val.kind == "report" and notif_data then
|
||||||
|
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
|
||||||
|
replace = notif_data.notification,
|
||||||
|
hide_from_history = false,
|
||||||
|
})
|
||||||
|
elseif val.kind == "end" and notif_data then
|
||||||
|
notif_data.notification =
|
||||||
|
vim.notify(val.message and format_message(val.message) or "Complete", "info", {
|
||||||
|
icon = "",
|
||||||
|
replace = notif_data.notification,
|
||||||
|
timeout = 3000,
|
||||||
|
})
|
||||||
|
|
||||||
|
notif_data.spinner = nil
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
@ -10,3 +10,6 @@ parser_config.hyprlang = {
|
|||||||
},
|
},
|
||||||
filetype = "conf", -- if filetype does not match the parser name
|
filetype = "conf", -- if filetype does not match the parser name
|
||||||
}
|
}
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user