diff src/testdir/test_ins_complete.vim @ 25372:c63a2d24b7e2 v8.2.3223

patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails Commit: https://github.com/vim/vim/commit/ff34bee3a2d22f2ff7abd4519270b5518082c33d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 25 20:27:06 2021 +0200 patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails Problem: Vim: using {} block in autoloade omnifunc fails. Solution: Allow using {} block when text is locked. (closes https://github.com/vim/vim/issues/8631)
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Jul 2021 20:30:04 +0200
parents f5225486d3de
children 31db9c6df4e3
line wrap: on
line diff
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -121,6 +121,37 @@ func Test_omni_dash()
   set omnifunc=
 endfunc
 
+func Test_omni_autoload()
+  let save_rtp = &rtp
+  set rtp=Xruntime/some
+  let dir = 'Xruntime/some/autoload'
+  call mkdir(dir, 'p')
+
+  let lines =<< trim END
+      vim9script
+      def omni#func(findstart: bool, base: string): any
+          if findstart
+              return 1
+          else
+              return ['match']
+          endif
+      enddef
+      {
+          eval 1 + 2
+      }
+  END
+  call writefile(lines, dir .. '/omni.vim')
+
+  new
+  setlocal omnifunc=omni#func
+  call feedkeys("i\<C-X>\<C-O>\<Esc>", 'xt')
+
+  bwipe!
+  call delete('Xruntime', 'rf')
+  set omnifunc=
+  let &rtp = save_rtp
+endfunc
+
 func Test_completefunc_args()
   let s:args = []
   func! CompleteFunc(findstart, base)