annotate runtime/autoload/adacomplete.vim @ 14135:ee649db58c41 v8.1.0085

patch 8.1.0085: no test for completing user name and language commit https://github.com/vim/vim/commit/5f8f2d378a4f6d7db12806f3e35ec6f7fc6bd1f3 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 19 19:09:09 2018 +0200 patch 8.1.0085: no test for completing user name and language Problem: No test for completing user name and language. Solution: Add tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/2978)
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Jun 2018 19:15:06 +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