]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1798: The 'syntax' option has no completion. v9.0.1798
authorDoug Kearns <dougkearns@gmail.com>
Sun, 27 Aug 2023 16:48:51 +0000 (18:48 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 27 Aug 2023 16:48:51 +0000 (18:48 +0200)
Problem:  The 'syntax' option has no completion.
Solution: Add syntax option completion.

closes: #12900

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
src/option.c
src/testdir/test_options.vim
src/version.c

index 15febb73c0c8b59447cbc8eecb5f2d2957b213f4..095653da75a8d0d7609ddcb232022c09ebcdbf84 100644 (file)
@@ -7374,6 +7374,14 @@ set_context_in_set_cmd(
 
     xp->xp_pattern = p + 1;
 
+#ifdef FEAT_SYN_HL
+    if (options[opt_idx].var == (char_u *)&p_syn)
+    {
+       xp->xp_context = EXPAND_OWNSYNTAX;
+       return;
+    }
+#endif
+
     if (flags & P_EXPAND)
     {
        p = options[opt_idx].var;
index fec8d2a94c5331da7fe3ed387961c160f11d77d4..fc81cec4eacfca506e08e4d4779341240ba15a94 100644 (file)
@@ -374,6 +374,12 @@ func Test_set_completion()
   call assert_equal('"set filetype=sshdconfig', @:)
   call feedkeys(":set filetype=a\<C-A>\<C-B>\"\<CR>", 'xt')
   call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
+
+  " Expand values for 'syntax'
+  call feedkeys(":set syntax=sshdconfi\<Tab>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"set syntax=sshdconfig', @:)
+  call feedkeys(":set syntax=a\<C-A>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"set syntax=' .. getcompletion('a*', 'syntax')->join(), @:)
 endfunc
 
 func Test_set_option_errors()
index bcba0991f7d219eb9c3b3156d3854388526f5336..fac0300e0b843e81891f8c8226fb781ff49dcd2c 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1798,
 /**/
     1797,
 /**/