About LSP keybindings for lua programming language

Hi all,

I try to add the function on_attach in the Lsp server configuration for the Lua programming language:

require'lspconfig'.lua_ls.setup {
   settings = {
      Lua = {
         runtime = {
            -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
            version = 'LuaJIT',
         },
         diagnostics = {
            -- Get the language server to recognize the `vim` global
            globals = {'vim'},
         },
         workspace = {
            -- Make the server aware of Neovim runtime files
            library = vim.api.nvim_get_runtime_file("", true),
         },
         -- Do not send telemetry data containing a randomized but unique identifier
         telemetry = {
            enable = false,
         },
      },
   },

   on_attach = function(client, bufnr)
      local function buf_set_keymap(...)
         vim.api.nvim_buf_set_keymap(bufnr, ...)
      end
      -- buffer key maps call
      require('keybindings').mapLSP(buf_set_keymap)

   end,
}

Anything wrong with the addition of the on_attach method inside the Lua lsp server configuration?

Many thanks.

is this adding effective? how can I test it? Thanks.

Just test the completion, which is working well, as well as lspsaga.
But not sure how to create buffer key settings for LSP.