annotate runtime/ftplugin/vb.vim @ 30888:54ba95d2d2eb v9.0.0778

patch 9.0.0778: indexing of unknown const type fails during compilation Commit: https://github.com/vim/vim/commit/4913d420e8e8619cff837372bce87683d6fcaa03 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 17 13:13:32 2022 +0100 patch 9.0.0778: indexing of unknown const type fails during compilation Problem: Indexing of unknown const type fails during compilation. Solution: Check for "any" properly. (closes https://github.com/vim/vim/issues/11389)
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Oct 2022 14:15:09 +0200
parents 786b2a8ec970
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin file
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
2 " Language: Visual Basic (ft=vb)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
4 " Previous Maintainer: Johannes Zellner <johannes@zellner.org>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
5 " Last Change: 2021 Nov 17
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
7 if exists("b:did_ftplugin")
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
8 finish
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
9 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
12 let s:cpo_save = &cpo
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
13 set cpo&vim
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
14
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
15 setlocal comments=sr:'\ -,mb:'\ \ ,el:'\ \ ,:'
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
16 setlocal commentstring='\ %s
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
17 setlocal formatoptions-=t formatoptions+=croql
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
18
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
19 let b:undo_ftplugin = "setlocal com< cms< fo<"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " we need this wrapper, as call doesn't allow a count
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
22 function! s:VbSearch(pattern, flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 let cnt = v:count1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 while cnt > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 call search(a:pattern, a:flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 let cnt = cnt - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 endwhile
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
28 endfunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
30 if !exists("no_plugin_maps") && !exists("no_vb_maps")
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
31 nnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
32 vnoremap <buffer> <silent> [[ <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sbW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
33 nnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
34 vnoremap <buffer> <silent> ]] <Cmd>call <SID>VbSearch('^\s*\%(\%(private\<Bar>public\)\s\+\)\=\%(function\<Bar>sub\)', 'sW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
35 nnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
36 vnoremap <buffer> <silent> [] <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sbW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
37 nnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
38 vnoremap <buffer> <silent> ][ <Cmd>call <SID>VbSearch('^\s*end\s\+\%(function\<Bar>sub\)', 'sW')<CR>
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
39 let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
40 \ " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
41 \ " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
42 \ " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['"
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
43 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
45 " TODO: line start anchors are almost certainly overly restrictive - allow
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
46 " after statement separators. Even in QuickBasic only block IF statements
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
47 " were required to be at the start of a line.
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
48 if exists("loaded_matchit") && !exists("b:match_words")
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
49 let b:match_ignorecase = 1
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
50 let b:match_words =
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
51 \ '\%(^\s*\)\@<=\<if\>.*\<then\>\s*\%($\|''\):\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<elseif\>:\%(^\s*\)\@<=\<end\>\s\+\<if\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
52 \ '\%(^\s*\)\@<=\<for\>:\%(^\s*\)\@<=\<next\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
53 \ '\%(^\s*\)\@<=\<while\>:\%(^\s*\)\@<=\<wend\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
54 \ '\%(^\s*\)\@<=\<do\>:\%(^\s*\)\@<=\<loop\>\s\+\<while\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
55 \ '\%(^\s*\)\@<=\<select\>\s\+\<case\>:\%(^\s*\)\@<=\<case\>:\%(^\s*\)\@<=\<end\>\s\+\<select\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
56 \ '\%(^\s*\)\@<=\<enum\>:\%(^\s*\)\@<=\<end\>\s\<enum\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
57 \ '\%(^\s*\)\@<=\<with\>:\%(^\s*\)\@<=\<end\>\s\<with\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
58 \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<function\>\s\+\([^ \t(]\+\):\%(^\s*\)\@<=\<\1\>\s*=:\%(^\s*\)\@<=\<end\>\s\+\<function\>,' .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
59 \ '\%(^\s*\)\@<=\%(\<\%(private\|public\)\>\s\+\)\=\<sub\>\s\+:\%(^\s*\)\@<=\<end\>\s\+\<sub\>'
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
60 let b:undo_ftplugin .= " | unlet! b:match_words b:match_ignorecase"
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
61 endif
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
62
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
63 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
64 let b:browsefilter = "Visual Basic Source Files (*.bas)\t*.bas\n" .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
65 \ "Visual Basic Form Files (*.frm)\t*.frm\n" .
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
66 \ "All Files (*.*)\t*.*\n"
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 233
diff changeset
67 let b:undo_ftplugin .= " | unlet! b:browsefilter"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 unlet s:cpo_save