annotate runtime/autoload/adacomplete.vim @ 20313:244eb8d8d100 v8.2.0712

patch 8.2.0712: various code not fully tested Commit: https://github.com/vim/vim/commit/0ff5dedf0f69e56320199db7a2aad46be2a1f9b7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 7 18:43:44 2020 +0200 patch 8.2.0712: various code not fully tested Problem: Various code not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6049)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 May 2020 18:45:04 +0200
parents 7bc41231fbc7
children 11b656e74444
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
1 "------------------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
2 " Description: Vim Ada omnicompletion file
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
3 " Language: Ada (2005)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
4 " $Id: adacomplete.vim 887 2008-07-08 14:29:01Z krischik $
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
5 " Maintainer: Martin Krischik
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
6 " $Author: krischik $
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
7 " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1121
diff changeset
8 " Version: 4.6
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
9 " $Revision: 887 $
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1121
diff changeset
10 " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/adacomplete.vim $
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
11 " History: 24.05.2006 MK Unified Headers
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
12 " 26.05.2006 MK improved search for begin of word.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
13 " 16.07.2006 MK Ada-Mode as vim-ball
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
14 " 15.10.2006 MK Bram's suggestion for runtime integration
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
15 " 05.11.2006 MK Bram suggested not to use include protection for
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
16 " autoload
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
17 " 05.11.2006 MK Bram suggested agaist using setlocal omnifunc
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
18 " 05.11.2006 MK Bram suggested to save on spaces
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
19 " Help Page: ft-ada-omni
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
20 "------------------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
21
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
22 if version < 700
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
23 finish
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
24 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
25
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
26 " Section: adacomplete#Complete () {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
27 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
28 " This function is used for the 'omnifunc' option.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
29 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
30 function! adacomplete#Complete (findstart, base)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
31 if a:findstart == 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
32 return ada#User_Complete (a:findstart, a:base)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
33 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
34 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
35 " look up matches
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
36 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
37 if exists ("g:ada_omni_with_keywords")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
38 call ada#User_Complete (a:findstart, a:base)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
39 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
40 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
41 " search tag file for matches
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
42 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
43 let l:Pattern = '^' . a:base . '.*$'
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
44 let l:Tag_List = taglist (l:Pattern)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
45 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
46 " add symbols
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
47 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
48 for Tag_Item in l:Tag_List
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
49 if l:Tag_Item['kind'] == ''
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
50 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
51 " Tag created by gnat xref
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
52 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
53 let l:Match_Item = {
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
54 \ 'word': l:Tag_Item['name'],
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
55 \ 'menu': l:Tag_Item['filename'],
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
56 \ 'info': "Symbol from file " . l:Tag_Item['filename'] . " line " . l:Tag_Item['cmd'],
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
57 \ 'kind': 's',
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
58 \ 'icase': 1}
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
59 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
60 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
61 " Tag created by ctags
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
62 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
63 let l:Info = 'Symbol : ' . l:Tag_Item['name'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
64 let l:Info .= 'Of type : ' . g:ada#Ctags_Kinds[l:Tag_Item['kind']][1] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
65 let l:Info .= 'Defined in File : ' . l:Tag_Item['filename'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
66
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
67 if has_key( l:Tag_Item, 'package')
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
68 let l:Info .= 'Package : ' . l:Tag_Item['package'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
69 let l:Menu = l:Tag_Item['package']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
70 elseif has_key( l:Tag_Item, 'separate')
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
71 let l:Info .= 'Separate from Package : ' . l:Tag_Item['separate'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
72 let l:Menu = l:Tag_Item['separate']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
73 elseif has_key( l:Tag_Item, 'packspec')
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
74 let l:Info .= 'Package Specification : ' . l:Tag_Item['packspec'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
75 let l:Menu = l:Tag_Item['packspec']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
76 elseif has_key( l:Tag_Item, 'type')
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
77 let l:Info .= 'Datetype : ' . l:Tag_Item['type'] . "\n"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
78 let l:Menu = l:Tag_Item['type']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
79 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
80 let l:Menu = l:Tag_Item['filename']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
81 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
82
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
83 let l:Match_Item = {
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
84 \ 'word': l:Tag_Item['name'],
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
85 \ 'menu': l:Menu,
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
86 \ 'info': l:Info,
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
87 \ 'kind': l:Tag_Item['kind'],
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
88 \ 'icase': 1}
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
89 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
90 if complete_add (l:Match_Item) == 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
91 return []
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
92 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
93 if complete_check ()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
94 return []
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
95 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
96 endfor
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
97 return []
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
98 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
99 endfunction adacomplete#Complete
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
100
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
101 finish " 1}}}
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
102
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
103 "------------------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
104 " Copyright (C) 2006 Martin Krischik
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
105 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
106 " Vim is Charityware - see ":help license" or uganda.txt for licence details.
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
107 "------------------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
108 " vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
109 " vim: foldmethod=marker