annotate runtime/ftplugin/zig.vim @ 34596:5a8340e044f4 v9.1.0190

patch 9.1.0190: complete_info() returns wrong order of items Commit: https://github.com/vim/vim/commit/8950bf7f8b85c1287d4e696965d88091fcc60594 Author: Girish Palya <girishji@gmail.com> Date: Wed Mar 20 20:07:29 2024 +0100 patch 9.1.0190: complete_info() returns wrong order of items Problem: complete_info() returns wrong order of items (after v9.0.2018) Solution: Revert Patch v9.0.2018 (Girish Palya) bug fix: complete_info() gives wrong results 1) complete_info() reverses list of items during <c-p> 2) 'selected' item index is wrong during <c-p> 3) number of items returnd can be wrong Solution: - Decouple 'cp_number' from 'selected' index since they need not be correlated - Do not iterate the list backwards - Add targeted tests Regression introduced by https://github.com/vim/vim/commit/69fb5afb3bc9da24c2fb0eafb0027ba9c6502fc2 Following are unnecessary commits to patch problems from above: https://github.com/vim/vim/commit/fef66301665027f1801a18d796f74584666f41ef https://github.com/vim/vim/commit/daef8c74375141974d61b85199b383017644978c All the tests from above commits are retained though. fixes: #14204 closes: #14241 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 20 Mar 2024 20:15:03 +0100
parents bd3ee5abdd7a
children 3b6868b38118
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Zig
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Upstream: https://github.com/ziglang/zig.vim
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Only do this when not done yet for this buffer
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("b:did_ftplugin")
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let b:did_ftplugin = 1
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 let s:cpo_orig = &cpo
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 set cpo&vim
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 compiler zig_build
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " Match Zig builtin fns
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 setlocal iskeyword+=@-@
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
32974
d46f974fd69e runtime: Fix typos in various files
Christian Brabandt <cb@256bit.org>
parents: 31383
diff changeset
20 " Recommended code style, no tabs and 4-space indentation
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 setlocal expandtab
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 setlocal tabstop=8
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 setlocal softtabstop=4
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 setlocal shiftwidth=4
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 setlocal formatoptions-=t formatoptions+=croql
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 setlocal suffixesadd=.zig,.zir
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 if has('comments')
33617
f7351afc42cf runtime(zig): Update Zig runtime files (#13388)
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
31 setlocal comments=:///,://!,://
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 setlocal commentstring=//\ %s
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 if has('find_in_path')
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")'
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)'
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)'
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
33223
def9fc5c92d1 patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents: 33203
diff changeset
42 " Safety check: don't execute zig from current directory
33096
828bcb1a37e7 patch 9.0.1833: [security] runtime file fixes
Christian Brabandt <cb@256bit.org>
parents: 32974
diff changeset
43 if !exists('g:zig_std_dir') && exists('*json_decode') &&
33716
bd3ee5abdd7a runtime(dist): centralize safe executable check and add vim library (#13413)
Christian Brabandt <cb@256bit.org>
parents: 33617
diff changeset
44 \ executable('zig') && dist#vim#IsSafeExecutable('zig', 'zig')
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 silent let s:env = system('zig env')
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 if v:shell_error == 0
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 let g:zig_std_dir = json_decode(s:env)['std_dir']
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 unlet! s:env
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 if exists('g:zig_std_dir')
33617
f7351afc42cf runtime(zig): Update Zig runtime files (#13388)
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
53 let &l:path = g:zig_std_dir . ',' . &l:path
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 let b:undo_ftplugin =
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 \ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<'
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 augroup vim-zig
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 autocmd! * <buffer>
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 augroup END
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 let b:undo_ftplugin .= '|au! vim-zig * <buffer>'
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 let &cpo = s:cpo_orig
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 unlet s:cpo_orig
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 " vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab