[vim/vim] Omni-completion for C structure members not work (#7292)

45 views
Skip to first unread message

Benjamin

unread,
Nov 13, 2020, 10:11:33 PM11/13/20
to vim/vim, Subscribed

Describe the bug
Omni-completion for C structure members doesn't work, while omni-completion for other C syntax (like functions, variables, etc) works fine.
The related runtime file should be $VIMRUNTIME/autoload/ccomplete.vim, which is maintained by Bram. So I suppose posting here is the correct place and correct way to report this issue.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run vim --clean
  2. Edit test.c
  3. Type
#include <stdio.h>

struct hello
{
    int a, b, c;
}

int main(void)
{
    struct hello t = {1, 2, 3};
    struct hello *p = &t;

    /* XXX */

    return 0;
}
  1. Generate tags file by running :!ctags %<CR>, or any other way you like.
  2. At the XXX marked position, type t. and try omni-completion by pressing Ctrl-X_Ctrl-O.
  3. At the XXX marked position, type p-> and try omni-completion by pressing Ctrl-X_Ctrl-O.

Expected behavior

After Ctrl-X_Ctrl-O, a popup-menu should appear with entries a, b, c.

Screenshots
t
p

Environment

  • Vim version: [8.2.1981]
    vim --version output:
Click to expand.

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 14 2020 10:31:47)
macOS version
Included patches: 1-1981
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl +title
-clientserver +job +persistent_undo -toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua +ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin -lpython3.9 -lintl -framework CoreFoundation -lruby.2.7

  • OS: [macOS 11.0.1]
  • Terminal: [Alacritty, tmux 3.1c]


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Nov 14, 2020, 11:08:50 AM11/14/20
to vim/vim, Subscribed

After a bit of debugging, it turns out this is not a problem in the C completion, but that :vimgrep doesn't work inside completion, even though it should be OK.

Bram Moolenaar

unread,
Nov 14, 2020, 11:26:36 AM11/14/20
to vim/vim, Subscribed

Closed #7292 via 33aecb1.

CrazyMoai

unread,
Dec 31, 2023, 11:18:47 AM12/31/23
to vim/vim, Subscribed

This issue is still replicable using gvim under windows. Console version is not affected.

To Reproduce

  1. Run gvim clean

  2. Follow the steps on the original bug report from the second one onwards.

Screenshots

structbug.PNG (view on web)
pointerbug.PNG (view on web)

Environment

  • Vim version: [9.0.2181]
    Vim version output:
Click me

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 19 2023 23:30:37)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-2181
Compiled by appveyor@APPVEYOR-VM
Huge version with GUI. Features included (+) or not (-):
+acl +conceal +float +lua/dyn +printer +tag_binary +virtualedit
+arabic +cryptv +folding +menu +profile -tag_old_static +visual
+autocmd +cscope -footer +mksession +python/dyn -tag_any_white +visualextra
+autochdir +cursorbind +gettext/dyn +modify_fname +python3/dyn-stable -tcl +vreplace
+autoservername +cursorshape -hangul_input +mouse +quickfix -termguicolors -vtp
+balloon_eval +dialog_con_gui +iconv/dyn +mouseshape +reltime +terminal +wildignore
-balloon_eval_term +diff +insert_expand +multi_byte_ime/dyn +rightleft -termresponse +wildmenu
+browse +digraphs +ipv6 +multi_lang +ruby/dyn +textobjects +windows
++builtin_terms +directx +job +mzscheme/dyn +scrollbind +textprop +writebackup
+byte_offset -dnd +jumplist +netbeans_intg +signs -tgetent -xattr
+channel -ebcdic +keymap +num64 +smartindent +timers -xfontset
+cindent +emacs_tags +lambda +ole +sodium/dyn +title -xim
+clientserver +eval +langmap +packages +sound +toolbar +xpm_w32
+clipboard +ex_extra +libcall +path_extra +spell +user_commands -xterm_save
+cmdline_compl +extra_search +linebreak +perl/dyn +startuptime +vartabs
+cmdline_hist -farsi +lispindent +persistent_undo +statusline +vertsplit
+cmdline_info +file_in_path +listcmds +popupwin -sun_workshop +vim9script
+comments +find_in_path +localmap -postscript +syntax +viminfo
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM_vimrc"
user exrc file: "$HOME_exrc"
2nd user exrc file: "$VIM_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM_gvimrc"
defaults file: "$VIMRUNTIME\defaults.vim"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT
JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -DFEAT_XPM_W32 -DHAVE_SODIUM -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL="libsodium.dll" /I "C:\projects\vim-win32-in
staller\dependencies\libsodium\include" -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 /source-charset:utf-8 /MP /Ox /GL -DNDEBUG /arch:SSE2 /Zl /MT /D_CRT_SECURE_NO

DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI
-DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL="lua54.dll" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python27.dll
" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL="python3.dll" -DDYNAMIC_PYTHON3_STABLE_ABI -DFEAT_MZSCHEME -I "C:\projects\vim-win32-installer\de
pendencies\racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL="libracket3m_dcgt6o.dll" -DDYNAMIC_MZGC_DLL="libracket3m_dcgt6o.dll" -D
FEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL="perl532.dll" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL="msvcr
t-ruby320.dll" -DRUBY_VERSION=32 -DFEAT_HUGE /Fd.\ObjGXOULYHRZi386/ /Zi
Linking: link /nologo /opt:ref /LTCG oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib netapi32.lib uuid.lib user32.lib /
machine:i386 version.lib winspool.lib comctl32.lib libcmt.lib oleaut32.lib /nodefaultlib:lua54.lib /STACK:8388608 /nodefaultlib:python27.lib /nodefaultli
b:python3.lib winmm.lib Ws2_32.lib xpm\x86\lib-vc14\libXpm.lib /PDB:gvim.pdb -debug

  • OS: [Microsoft Windows 10 Pro N 10.0.19045 Build 19045]

  • Terminal: None, Gui used.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/1872986629@github.com>

Marco Trosi

unread,
Feb 12, 2025, 4:49:21 PM2/12/25
to vim/vim, Subscribed

I still have the same problem. Completing from the tags file generally works, only the struct members fail. ( dot and -> notation)

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 10 2025 21:13:43)
macOS version - arm64
Included patches: 1-1100


Compiled by Homebrew
Huge version without GUI.

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 11 2024 06:07:33)
macOS version - arm64
Included patches: 1-727
Compiled by GitHub Actions
Huge version with MacVim GUI.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/2654916374@github.com>

dimmsmile

unread,
Feb 12, 2026, 2:46:00 AM (3 days ago) Feb 12
to vim/vim, Subscribed
dimmsmile left a comment (vim/vim#7292)

Same problem!

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Oct 4 2025 22:16:32)
MS-Windows 64-bit GUI/console version with OLE support
Included patches: 1-1825
Compiled by appveyor@APPVEYOR-VM


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3889167616@github.com>

Marco Trosi

unread,
Feb 12, 2026, 1:23:28 PM (2 days ago) Feb 12
to vim/vim, Subscribed
marcotrosi left a comment (vim/vim#7292)

@chrisbra shall we re-open this issue?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3892644533@github.com>

Christian Brabandt

unread,
Feb 13, 2026, 4:36:37 AM (yesterday) Feb 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#7292)

CAn you check if this regressed?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3896020257@github.com>

Christian Brabandt

unread,
Feb 13, 2026, 4:36:38 AM (yesterday) Feb 13
to vim/vim, Subscribed

Reopened #7292.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/7292/issue_event/22761050035@github.com>

dimmsmile

unread,
Feb 13, 2026, 7:59:11 AM (yesterday) Feb 13
to vim/vim, Subscribed
dimmsmile left a comment (vim/vim#7292)

I just tested this on a freshly compiled version (MS-Windows 64-bit console version
Included patches: 1-2147). The issue is still not fixed.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897115095@github.com>

Christian Brabandt

unread,
Feb 13, 2026, 9:06:18 AM (yesterday) Feb 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#7292)

Can you check if the above mentioned commit fixed and some later commit broke it? In other words, dann you bisect the offending commit?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897418665@github.com>

dimmsmile

unread,
Feb 13, 2026, 10:22:35 AM (yesterday) Feb 13
to vim/vim, Subscribed
dimmsmile left a comment (vim/vim#7292)

Can you check if the above mentioned commit fixed and some later commit broke it? In other words, dann you bisect the offending commit?

git checkout 33aecb1
(MinGW64) make -f Make_ming.mak GUI=no

tags file:
!_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/;" extras:pseudo !_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/;" extras:pseudo !_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/;" extras:pseudo !_TAG_EXTRA_DESCRIPTION qualified /Include an extra class-qualified tag entry for each tag/;" extras:pseudo !_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/;" extras:pseudo !_TAG_FIELD_DESCRIPTION access /Access (or export) of class members/;" extras:pseudo !_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/;" extras:pseudo !_TAG_FIELD_DESCRIPTION extras /Extra tag type information/;" extras:pseudo !_TAG_FIELD_DESCRIPTION file /File-restricted scoping/;" extras:pseudo !_TAG_FIELD_DESCRIPTION inherits /Inheritance information/;" extras:pseudo !_TAG_FIELD_DESCRIPTION input /input file/;" extras:pseudo !_TAG_FIELD_DESCRIPTION kind /[tags output] prepend "kind:" to k\/ (or K\/) field output, [xref and json output] kind in long-name form/;" extras:pseudo !_TAG_FIELD_DESCRIPTION name /tag name/;" extras:pseudo !_TAG_FIELD_DESCRIPTION pattern /pattern/;" extras:pseudo !_TAG_FIELD_DESCRIPTION signature /Signature of routine (e.g. prototype or parameter list)/;" extras:pseudo !_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/;" extras:pseudo !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/;" extras:pseudo !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C d,macro /macro definitions/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C e,enumerator /enumerators (values inside an enumeration)/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C f,function /function definitions/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C g,enum /enumeration names/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C h,header /included header files/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C m,member /struct, and union members/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C p,prototype /function prototypes/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C s,struct /structure names/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C t,typedef /typedefs/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C u,union /union names/;" extras:pseudo !_TAG_KIND_DESCRIPTION!C v,variable /variable definitions/;" extras:pseudo !_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/;" extras:pseudo !_TAG_OUTPUT_FILESEP slash /slash or backslash/;" extras:pseudo !_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/;" extras:pseudo !_TAG_OUTPUT_VERSION 1.1 /current.age/;" extras:pseudo !_TAG_PARSER_VERSION!C 1.1 /current.age/;" extras:pseudo !_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/;" extras:pseudo !_TAG_PROC_CWD D:/ds/dev/t/ //;" extras:pseudo !_TAG_PROGRAM_AUTHOR Universal Ctags Team //;" extras:pseudo !_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/;" extras:pseudo !_TAG_PROGRAM_URL https://ctags.io/ /official site/;" extras:pseudo !_TAG_PROGRAM_VERSION 6.2.1 /v6.2.1/;" extras:pseudo !_TAG_ROLE_DESCRIPTION!C!function foreigndecl /declared in foreign languages/;" extras:pseudo !_TAG_ROLE_DESCRIPTION!C!header local /local header/;" extras:pseudo !_TAG_ROLE_DESCRIPTION!C!header system /system header/;" extras:pseudo !_TAG_ROLE_DESCRIPTION!C!macro undef /undefined/;" extras:pseudo !_TAG_ROLE_DESCRIPTION!C!struct foreigndecl /declared in foreign languages/;" extras:pseudo Foo ./test.c /^ int Foo() { a = b; }$/;" kind:f struct:Test typeref:typename:int file: access:public signature:() extras:fileScope Test ./test.c /^struct Test {$/;" kind:s file: extras:fileScope Test::Foo ./test.c /^ int Foo() { a = b; }$/;" kind:f struct:Test typeref:typename:int file: access:public signature:() extras:fileScope,qualified Test::a ./test.c /^ int a;$/;" kind:m struct:Test typeref:typename:int file: access:public extras:fileScope,qualified Test::b ./test.c /^ int b;$/;" kind:m struct:Test typeref:typename:int file: access:public extras:fileScope,qualified a ./test.c /^ int a;$/;" kind:m struct:Test typeref:typename:int file: access:public extras:fileScope b ./test.c /^ int b;$/;" kind:m struct:Test typeref:typename:int file: access:public extras:fileScope main ./test.c /^int main() {$/;" kind:f typeref:typename:int signature:()

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 13 2026 17:57:33)
MS-Windows 64-bit console version
Included patches: 1-1984
Huge version without GUI.

(:filetype) filetype detection:ON plugin:ON indent:OFF
(:set filetype?) filetype=c
(:set omnifunc?) omnifunc=ccomplete#Complete

test.c
1 struct Test { 2 int a; 3 int b; 4 int Foo() { a = b; } 5 }; 6 7 int main() { 8 Test t; 9 t. 10 return 0; 11 }

At the line 8 CTRL-X CTRL-O works normal:
1 cmd struct Test { 2 extras fileScope 3 filename ./test.c 4 kind s 5 name Test 6 static 1 ~ ~ ~ ~ [Scratch] [Preview]

At the line 9 (after dot) CTRL-X CTRL-O prints:
-- Omni completion (^O^N^P) Pattern not found
What did I do wrong?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897786907@github.com>

Marco Trosi

unread,
Feb 13, 2026, 10:30:00 AM (yesterday) Feb 13
to vim/vim, Subscribed
marcotrosi left a comment (vim/vim#7292)

@dimmsmile so this means that the commit 33aecb1 that was supposed to fix it, actually never fixed it? or maybe there was more than issue and Bram fixed only 1?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897824690@github.com>

dimmsmile

unread,
Feb 13, 2026, 10:32:59 AM (yesterday) Feb 13
to vim/vim, Subscribed
dimmsmile left a comment (vim/vim#7292)

@marcotrosi I think this commit fixed something, but it didn't solve the problem (omni after dot).


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897841355@github.com>

Marco Trosi

unread,
Feb 13, 2026, 10:50:59 AM (yesterday) Feb 13
to vim/vim, Subscribed
marcotrosi left a comment (vim/vim#7292)

don't ask me why, but today it's working for me. both, dot and arrow notation. I have no clue what I did differently back then.

@dimmsmile did you create the ctags file and ":set tags=.tags or set tags=tags" depending on your tags filename?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897926743@github.com>

Marco Trosi

unread,
Feb 13, 2026, 10:55:51 AM (yesterday) Feb 13
to vim/vim, Subscribed
marcotrosi left a comment (vim/vim#7292)

with MacVim it works too

image.png (view on web)

the only thing I don't like is that the completion adds . after the struct members.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3897948407@github.com>

dimmsmile

unread,
Feb 13, 2026, 11:20:05 AM (yesterday) Feb 13
to vim/vim, Subscribed
dimmsmile left a comment (vim/vim#7292)

did you create the ctags file and ":set tags=.tags or set tags=tags" depending on your tags filename?

Directory of D:\ds\dev\t

13.02.2026  19:07    <DIR>          .
13.02.2026  19:07    <DIR>          ..
13.02.2026  18:02             4 373 tags
13.02.2026  19:06               125 test.c
               2 File(s)          4 498 bytes

(:set tags?) tags=./tags,tags

I also tried a clean installation of Vim, removing the .vimrc file from my home directory and deleting the vimfiles folder. Could the issue be caused by the operating system? For example, the OmniCppComplete plugin works perfectly under the same conditions.
It looks like I'm doing something wrong, but I just can't figure out what.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/7292/3898061567@github.com>

Reply all
Reply to author
Forward
0 new messages