From 2790982ad123115c6ddbc5764677fdca27668cea Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sun, 24 Apr 2022 00:06:19 -0400 Subject: [PATCH] fix: no command completions if query/line is an alias basically, i have a `c` alias which is `git commit`, this would resolve to `git commit` literally to try and complete `commit`, which wouldnt match. this fixes that, and instead itll suggest commands that start with `c`. if there is a space after and completion is requested, itll use the alias properly --- nature/completions.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nature/completions.lua b/nature/completions.lua index 8561e04..d20cc59 100644 --- a/nature/completions.lua +++ b/nature/completions.lua @@ -6,8 +6,12 @@ function hilbish.completion.handler(line, pos) local ctx = line:gsub('^%s*(.-)$', '%1') if ctx:len() == 0 then return {}, '' end - ctx = hilbish.aliases.resolve(ctx) + local res = hilbish.aliases.resolve(ctx) + local resFields = string.split(res, ' ') local fields = string.split(ctx, ' ') + if #fields > 1 and #resFields > 1 then + fields = resFields + end local query = fields[#fields] if #fields == 1 then