@@ -229,6 +229,39 @@ function M.setup(opts)
229229 -- TODO: remove check when dropping support for Neovim v0.9
230230 if vim .lsp .inlay_hint then vim .lsp .inlay_hint .enable (M .config .features .inlay_hints ~= false ) end
231231
232+ -- Set up tracking of signature help trigger characters
233+ local augroup = vim .api .nvim_create_augroup (" track_signature_help_triggers" , { clear = true })
234+ vim .api .nvim_create_autocmd (" LspAttach" , {
235+ group = augroup ,
236+ desc = " Add signature help triggers as language servers attach" ,
237+ callback = function (args )
238+ local client = vim .lsp .get_client_by_id (args .data .client_id )
239+ if client and client .supports_method " textDocument/signatureHelp" then
240+ vim .b [args .buf ].signature_help_trigger = require (" astrocore" ).list_insert_unique (
241+ vim .b [args .buf ].signature_help_trigger ,
242+ client .server_capabilities .signatureHelpProvider .triggerCharacters or {}
243+ )
244+ end
245+ end ,
246+ })
247+ vim .api .nvim_create_autocmd (" LspDetach" , {
248+ group = augroup ,
249+ desc = " Safely remove LSP signature help triggers when language servers detach" ,
250+ callback = vim .schedule_wrap (function (args )
251+ if not vim .api .nvim_buf_is_valid (args .buf ) then return end
252+ local signature_help_trigger = {}
253+ for _ , client in pairs ((vim .lsp .get_clients or vim .lsp .get_active_clients ) { bufnr = args .buf }) do
254+ if client .id ~= args .data .client_id and client .supports_method " textDocument/signatureHelp" then
255+ require (" astrocore" ).list_insert_unique (
256+ signature_help_trigger ,
257+ client .server_capabilities .signatureHelpProvider .triggerCharacters or {}
258+ )
259+ end
260+ end
261+ vim .b [args .buf ].signature_help_trigger = signature_help_trigger
262+ end ),
263+ })
264+
232265 vim .api .nvim_create_autocmd (" LspDetach" , {
233266 group = vim .api .nvim_create_augroup (" astrolsp_detach" , { clear = true }),
234267 desc = " Clear state when language server is detached like LSP progress messages" ,
0 commit comments