Skip to content

Commit

Permalink
little change for signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 21, 2025
1 parent 1956025 commit 324bcb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions lua/LspUI/signature/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local api, fn = vim.api, vim.fn
local api = vim.api
local config = require("LspUI.config")
local lib_notify = require("LspUI.lib.notify")
local util = require("LspUI.signature.util")
Expand All @@ -7,7 +7,7 @@ local M = {}

local is_initialized = false

M.init = function()
function M.init()
if not config.options.signature.enable then
return
end
Expand All @@ -34,7 +34,7 @@ M.init = function()
util.autocmd()
end

M.deinit = function()
function M.deinit()
if not is_initialized then
lib_notify.Info("signature has been deinit")
end
Expand All @@ -45,7 +45,7 @@ M.deinit = function()
util.deautocmd()
end

M.run = function()
function M.run()
lib_notify.Info("signature has no run func")
end

Expand Down
20 changes: 10 additions & 10 deletions lua/LspUI/signature/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ local is_there_virtual_text = false
--- @field doc string?

--- @param help lsp.SignatureHelp|nil
--- @param client_name string|nil
--- @param _ string|nil client name
--- @return signature_info? res len will not be zero
local build_signature_info = function(help, client_name)
local function build_signature_info(help, _)
if not help then
return nil
end
Expand Down Expand Up @@ -98,7 +98,7 @@ local backup = {}

--- @param buffer_id number buffer's id
--- @param callback fun(result: lsp.SignatureHelp|nil,client_name:string|nil) callback function
M.request = function(buffer_id, callback)
function M.request(buffer_id, callback)
-- this buffer id maybe invalid
if not api.nvim_buf_is_valid(buffer_id) then
return
Expand Down Expand Up @@ -140,7 +140,7 @@ end
-- get all valid clients for lightbulb
--- @param buffer_id integer
--- @return vim.lsp.Client[]|nil clients array or nil
M.get_clients = function(buffer_id)
function M.get_clients(buffer_id)
local clients =
lsp.get_clients({ bufnr = buffer_id, method = signature_feature })
if vim.tbl_isempty(clients) then
Expand All @@ -152,7 +152,7 @@ end
--- @type function
local func

local signature_handle = function()
local function signature_handle()
local current_buffer = api.nvim_get_current_buf()
-- when current buffer can not use signature
if not buffer_list[current_buffer] then
Expand Down Expand Up @@ -183,7 +183,7 @@ local signature_handle = function()
end)
end

local build_func = function()
local function build_func()
if not config.options.signature.debounce then
func = signature_handle
return
Expand All @@ -200,9 +200,9 @@ end

--- @param data lsp.SignatureHelp|nil
--- @param buffer_id integer
--- @param windows_id integer
--- @param _ integer window id
--- @param client_name string|nil
M.render = function(data, buffer_id, windows_id, client_name)
function M.render(data, buffer_id, _, client_name)
local info = build_signature_info(data, client_name)
if not info then
return
Expand Down Expand Up @@ -237,7 +237,7 @@ end

-- clean signature virtual text
--- @param buffer_id integer
M.clean_render = function(buffer_id)
function M.clean_render(buffer_id)
if not is_there_virtual_text then
return
end
Expand All @@ -247,7 +247,7 @@ M.clean_render = function(buffer_id)
end

-- this is autocmd init for signature
M.autocmd = function()
function M.autocmd()
signature_group =
api.nvim_create_augroup("Lspui_signature", { clear = true })

Expand Down

0 comments on commit 324bcb8

Please sign in to comment.