Browse Source

feat(luadev): better vim api completion (#2043)

Jieru Mei 3 years ago
parent
commit
53427670d1
2 changed files with 22 additions and 6 deletions
  1. 18 3
      lua/lvim/lsp/providers/sumneko_lua.lua
  2. 4 3
      lua/lvim/plugins.lua

+ 18 - 3
lua/lvim/lsp/providers/sumneko_lua.lua

@@ -7,8 +7,6 @@ local opts = {
       workspace = {
         library = {
           [require("lvim.utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true,
-          [vim.fn.expand "$VIMRUNTIME/lua"] = true,
-          [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
         },
         maxPreload = 100000,
         preloadFileSize = 10000,
@@ -16,4 +14,21 @@ local opts = {
     },
   },
 }
-return opts
+
+local lua_dev_loaded, lua_dev = pcall(require, "lua-dev")
+if not lua_dev_loaded then
+  return opts
+end
+
+local dev_opts = {
+  library = {
+    vimruntime = true, -- runtime path
+    types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
+    -- plugins = true, -- installed opt or start plugins in packpath
+    -- you can also specify the list of plugins to make available as a workspace library
+    plugins = { "plenary.nvim" },
+  },
+  lspconfig = opts,
+}
+
+return lua_dev.setup(dev_opts)

+ 4 - 3
lua/lvim/plugins.lua

@@ -3,7 +3,7 @@ local commit = {
   cmp_buffer = "a01cfeca70594f505b2f086501e90fb6c2f2aaaa",
   cmp_luasnip = "7bd2612533db6863381193df83f9934b373b21e1",
   cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81",
-  cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21",
+  lua_dev = "4331626b02f636433b504b9ab6a8c11fb9de4a24",
   cmp_path = "81d88dfcafe26cc0cc856fc66f4677b20e6a9ffc",
   comment = "9e80d5146013275277238c89bbcaf4164f4e5140",
   dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425",
@@ -115,8 +115,9 @@ return {
     commit = commit.cmp_path,
   },
   {
-    "hrsh7th/cmp-nvim-lua",
-    commit = commit.cmp_nvim_lua,
+    "folke/lua-dev.nvim",
+    module = "lua-dev",
+    commit = commit.lua_dev,
   },
 
   -- Autopairs