aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/vim.lua
diff options
context:
space:
mode:
authorTony Chen <tchen1998@gmail.com>2020-11-30 08:33:52 -0500
committerchentau <tchen1998@gmail.com>2021-01-26 17:04:32 -0800
commitd95a465b4399c3c10b83925935ec5f4807d65b60 (patch)
tree5a356442adb3cd61483cf0dfb6958731d58b1249 /src/nvim/lua/vim.lua
parent901dd79f6a5ee78a55d726abca868bebff117ca9 (diff)
downloadrneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.tar.gz
rneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.tar.bz2
rneovim-d95a465b4399c3c10b83925935ec5f4807d65b60.zip
Don't show entire context when completing
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r--src/nvim/lua/vim.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 3e601586ea..49c34c5b89 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -547,7 +547,7 @@ function vim._expand_pat(pat, env)
if pat == '' then
local result = vim.tbl_keys(env)
table.sort(result)
- return result
+ return result, 0
end
-- TODO: We can handle spaces in [] ONLY.
@@ -558,7 +558,7 @@ function vim._expand_pat(pat, env)
-- Get the last part of the pattern
local last_part = pat:match("[%w.:_%[%]'\"]+$")
- if not last_part then return {} end
+ if not last_part then return {}, 0 end
local parts, search_index = vim._expand_pat_get_parts(last_part)
@@ -568,11 +568,11 @@ function vim._expand_pat(pat, env)
local final_env = env
for _, part in ipairs(parts) do
if type(final_env) ~= 'table' then
- return {}
+ return {}, 0
end
-- Normally, we just have a string
- -- Just attempt to get the string directly from the environment
+ -- Just attempt to get the string directly from the environment
if type(part) == "string" then
final_env = rawget(final_env, part)
else
@@ -584,32 +584,32 @@ function vim._expand_pat(pat, env)
-- -> _G[MY_VAR] -> "api"
local result_key = part[1]
if not result_key then
- return {}
+ return {}, 0
end
local result = rawget(env, result_key)
if result == nil then
- return {}
+ return {}, 0
end
final_env = rawget(final_env, result)
end
if not final_env then
- return {}
+ return {}, 0
end
end
local result = vim.tbl_map(function(v)
- return prefix_match_pat .. v
+ return v
end, vim.tbl_filter(function(name)
return string.find(name, match_pat) ~= nil
end, vim.tbl_keys(final_env)))
table.sort(result)
- return result
+ return result, #prefix_match_pat
end
vim._expand_pat_get_parts = function(lua_string)