ycm-core/YouCompleteMe

Does not auto complete identifiers that are not in the current file without scope in c++

otomn opened this issue · 1 comments

otomn commented

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I
    expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

  • Create a header file test.h
extern int someInt;
namespace Test {
  static int testInt = 0;
}
  • Create a cpp file test.cpp
#include "test.h"
using namespace Test;
void main()
{
  some // expect autocompletion `someInt` but got nothing
  ::some // got autocompletion `::someInt`
  test // expect autocompletion `testInt` but got nothing
  Test::test // got autocompletion `Test ::testInt`
}

Diagnostic data

Output of vim --version

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Aug 28 2022 16:44:20)
macOS version - x86_64
Included patches: 1-300
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   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 -D_REENTRANT -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.4 -mmacosx-version-min=12.0 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin -lpython3.10 -framework CoreFoundation -lruby.3.1 -L/usr/local/Cellar/ruby/3.1.2_1/lib 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...                       
-- Resolve completions: Never
-- Client logfile: /var/folders/4_/v5r8kd81215dtnxlv9vsqpkw0000gn/T/ycm_nyjyhz69.log

-- Server Python interpreter: /usr/local/opt/python@3.10/bin/python3.10
-- Server Python version: 3.10.6
-- Server has Clang support compiled in: True
-- Clang version: clang version 14.0.0 (https://github.com/tru/llvm-release-build fc
075d7c96fe7c992dde351695a5d25fe084794a)
-- No extra configuration file found
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 49878
--   Clangd executable: ['/Users/toby/.vim/bundle/YouCompleteMe/third_party/ycmd/thi
rd_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir
=/Users/toby/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/
14.0.0', '-limit-results=500']
--   Clangd logfiles:
--     /var/folders/4_/v5r8kd81215dtnxlv9vsqpkw0000gn/T/clangd_stderrr3pxjwdv.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /Users/toby/test
--   Clangd Settings: {}
--   Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:57706
-- Server process ID: 49876
-- Server logfiles:
--   /var/folders/4_/v5r8kd81215dtnxlv9vsqpkw0000gn/T/ycmd_57706_stdout_ifq5ya6v.log

--   /var/folders/4_/v5r8kd81215dtnxlv9vsqpkw0000gn/T/ycmd_57706_stderr_z941uy81.log

-- Semantic highlighting supported: True
-- Virtual text supported: True
-- Popup windows supported: True

I have read and understood YCM's README, especially the
Frequently Asked Questions section.

Well, this is explained in the very first entry in the FAQ, so I'm fairly sure you didn't do that.