summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-13 18:38:48 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-13 18:38:48 +0200
commit4ee9d8e04daa97a3d0a19d7d2eed76b7721301e6 (patch)
treea896c1eca248cbf2c8269c8d6b593406fbb43b18 /src/vim9execute.c
parente70e12b32f193addae88ae8df933b04fc234550f (diff)
downloadvim-git-4ee9d8e04daa97a3d0a19d7d2eed76b7721301e6.tar.gz
patch 8.2.2992: Vim9: completion for :disassemble is incompletev8.2.2992
Problem: Vim9: completion for :disassemble is incomplete. Solution: Recognize the "debug" and "profile" arguments.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 04c1ee2f2..d55fa0c9d 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -5371,6 +5371,40 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
}
/*
+ * Handle command line completion for the :disassemble command.
+ */
+ void
+set_context_in_disassemble_cmd(expand_T *xp, char_u *arg)
+{
+ char_u *p;
+
+ // Default: expand user functions, "debug" and "profile"
+ xp->xp_context = EXPAND_DISASSEMBLE;
+ xp->xp_pattern = arg;
+
+ // first argument already typed: only user function names
+ if (*arg != NUL && *(p = skiptowhite(arg)) != NUL)
+ {
+ xp->xp_context = EXPAND_USER_FUNC;
+ xp->xp_pattern = skipwhite(p);
+ }
+}
+
+/*
+ * Function given to ExpandGeneric() to obtain the list of :disassemble
+ * arguments.
+ */
+ char_u *
+get_disassemble_argument(expand_T *xp, int idx)
+{
+ if (idx == 0)
+ return (char_u *)"debug";
+ if (idx == 1)
+ return (char_u *)"profile";
+ return get_user_func_name(xp, idx - 2);
+}
+
+/*
* ":disassemble".
* We don't really need this at runtime, but we do have tests that require it,
* so always include this.