Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For user commands, the parsed
arg
was everything in the cmdline after the command name. This meant that for:DiffviewOpen origin/master --i
, thearg
wasorigin/master --i
. The completions returned bygetcompletion(cmdline, 'cmdline')
returned the completions that are prefixed by the last argument (--i
, for example--imply-local
). Then, the filtering code attempted to filter the completions (["--imply-local"]
) usingorigin/master --i
, which did not match. For thearg
, only the last argument (--i
) should be used in this case for the filtering to return the correct completions.The consequence was that completions for the 2nd and subsequent were not shown for user commands with
complete
functions in Lua.This commit changes the cmdline parsing logic so that for user commands, only the last argument in the cmdline is parsed as the
arg
. This way the filtering logic correctly matches--imply-local
as a valid completion for--i
.The following commands now show completions, whereas they did not show any completions before:
Peek.2022-11-18.12-51.mp4
I didn't notice anything break at first sight. Completions for other types of commands seems to be working.
Fixes #159