petertriho / cmp-git

Git source for nvim-cmp
MIT License
397 stars 23 forks source link

mention for Gitlab inserts nil instead of username #63

Closed jakubbortlik closed 6 months ago

jakubbortlik commented 6 months ago

Hi and thanks for your plugin!

I've come across an issue with the Gitlab mentions completion. It inserts nil instead of the username, even if the list of usernames and the documentation show the correct values. This can be fixed by the following change to cmp-git/lua/cmp_git/format.lua:

diff --git a/lua/cmp_git/format.lua b/lua/cmp_git/format.lua                                                                                                                                   
index a76dc20..2c4aa02 100644                                                                                                                                                                  
--- a/lua/cmp_git/format.lua                                                                                                                                                                   
+++ b/lua/cmp_git/format.lua                                                                                                                                                                   
@@ -104,7 +104,7 @@ local M = {                                                                                                                                                                
                 return string.format("@%s", mention.username)                                                                                                                                 
             end,                                                                                                                                                                              
             insertText = function(trigger_char, mention)                                                                                                                                      
-                return string.format("@%s", mention.login)                                                                                                                                    
+                return string.format("@%s", mention.username)                                                                                                                                 
             end,                                                                                                                                                                              
             filterText = function(trigger_char, mention)                                                                                                                                      
                 return string.format("%s %s", trigger_char, mention.username)

I'll be happy to open a pull request with the fix.

petertriho commented 6 months ago

A PR for the fix would be great. Thanks