adacomplete.vim 3.6 KB

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