ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

Issue with C++20 Syntax Checking #4249

Closed cbtxs closed 2 months ago

cbtxs commented 2 months ago

Issue Prelude

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

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

Provide a clear description of the problem, including the following key questions:

I apologize for my previous question which was not meaningful. I am very grateful for your time in addressing my issues. My computer system is Ubuntu 22.04. I am a beginner in C++ and have been using tools from versions prior to C++17. In the .ycm_extra_conf file, there is a flag '-std=c++17', and with this setting, YCM runs without issues. However, I recently need to write programs based on C++20, using the ranges library. When I simply change '-std=c++17' to '-std=c++20', it doesn't work.

template struct my_view : std::ranges::viewbase { Rng base;

my_view() = default;
my_view(Rng base) : base_(std::move(base)) {}

auto begin() { return base_.begin(); }
auto end() { return base_.end(); }

};

int main() { std::vector vec = {1, 2, 3, 4, 5}; my_view<std::vector > view(vec);

for (int i : view) {
    std::cout << i << " ";
}

}

> Include steps to reproduce here.

1. `vim ranges.cpp`

> Include description of a minimal test case, including any actual code required
> to reproduce the issue.

That is the code above

> If you made changes to `vimrc_ycm_minimal`, pase them here:
``` * What did you expect to happen? > Include description of the expected behaviour. * What actually happened? > Include description of the observed behaviour, including actual output, > screenshots, etc. # Diagnostic data ## Output of `vim --version` ``` VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37) Included patches: 1-749 Modified by team+vim@tracker.debian.org Compiled by team+vim@tracker.debian.org Huge version with GTK3 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_gui +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_interact +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" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-cdpF6P/vim-9.0.0749=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -lcanberra -lsodium -lacl -lattr -lgpm -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-3.0 -lm -L/usr/lib ``` ## Output of `YcmDebugInfo` ``` Printing YouCompleteMe debug information... -- Resolve completions: Up front -- Client logfile: /tmp/ycm_jgu2vyzx.log -- Server Python interpreter: /usr/bin/python3 -- Server Python version: 3.10.12 -- Server has Clang support compiled in: True -- Clang version: clang version 9.0.0 (/home/vagrant/llvm/llvm-9.0.0.src/tools/clang 038587147cf2f97d1c3e677042f69560c65b5bea) -- Extra configuration file found and loaded -- Extra configuration path: /home/cbtxs/repository/HalfEdgeMesh/.ycm_extra_conf.py -- C-family completer debug information: -- Clangd running -- Clangd process ID: 609259 -- Clangd executable: ['/home/cbtxs/repository/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-deco rators=0', '-resource-dir=/home/cbtxs/repository/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/9.0.0', '-limit-results=500'] -- Clangd logfiles: -- /tmp/clangd_stderrad98da4e.log -- Clangd Server State: Initialized -- Clangd Project Directory: /home/cbtxs/repository/HalfEdgeMesh -- Clangd Settings: {} -- Clangd Compilation Command: ['clang-tool', '-Wall', '-Wextra', '-Werror', '-std=c++20', '-isystem', '-x', 'c++', '-isystem', '/usr/include/python3.1 0', '-isystem', '/usr/include/x86_64-linux-gnu/c++/11', '-isystem', '/usr/include/c++/11', '-isystem', ' /usr/include/c++/11/backward', '-isystem', '/usr /lib/gcc/x86_64-linux-gnu/11/include', '-isystem', '/usr/include', '-isystem', '/usr/include/cairomm-1.0', '-isystem', '/usr/include/cairo', '-isystem', '/usr/include/glib-2.0', '-isystem', '/usr/include/harfbuzz', '-isystem', '/usr/include/gtk-3.0', '-isystem', '/usr/include/atk-1.0', '-isystem', '/usr/i nclude/freetype2', '-isystem', '/usr/include/gdk-pixbuf-2.0', '-isystem', '/usr/include/pango-1.0', '-isystem', '/usr/include/sigc++-2.0', '-isystem', '/ usr/lib/x86_64-linux-gnu/glib-2.0/include', '-isystem', '/usr/lib/x86_64-linux-gnu/cairomm-1.0/include', '-isystem', '/usr/lib/x86_64-linux-gnu/sigc++-2. 0/include', '-isystem', '/usr/lib/gcc/x86_64-linux-gnu/11/include', '-isystem', '/usr/include/eigen3', '-isystem', '/usr/local/include', '-isystem', '/us r/lib/x86_64-linux-gnu/openmpi/include/openmpi', '-I', '/usr/lib/x86_64-linux-gnu/openmpi/include/', '-I', './include', '-I', './thirdparty/include', '-I ', '/home/cbtxs/.local/vtk/include/vtk-9.2', '-I', '/home/cbtxs/.local/include', '-I', '/home/cbtxs/.local/mfem/include', '-I', '/home/cbtxs/.local/cgal/ include', '-I', '/home/cbtxs/.local/googletest/include', '/home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp'] -- Server running at: http://127.0.0.1:41779 -- Server process ID: 609195 -- Server logfiles: -- /tmp/ycmd_41779_stdout_epjdoh6b.log -- /tmp/ycmd_41779_stderr_072n239z.log -- Semantic highlighting supported: True -- Virtual text supported: True -- Popup windows supported: True ``` ## Output of `YcmDiags` ``` 1 test_ranges.cpp|6 col 23 error| No member named 'ranges' in namespace 'std' [no_member] 2 test_ranges.cpp|6 col 31 error| Expected class name [expected_class_name] ``` ## Output of `git rev-parse HEAD` in YouCompleteMe installation directory ``` 9a5eb4443e8a990698daa99da512d0fd7aed0f32 ``` ## Contents of YCM, ycmd and completion engine logfiles > Reproduce the issue with `vim -Nu /path/to/YCM/vimrc_ycm_minimal`, which > enabled debug logging and other useful diagnostics. Include a link to a > [gist][] containing all of the log files listed by `:YcmToggleLogs`. ## OS version, distribution, etc. > Include system information here. ## Output of build/install commands > Include link to a [gist][] containing the invocation and entire output of > `install.py` if reporting an installation issue. [cont]: https://github.com/ycm-core/YouCompleteMe/blob/master/CONTRIBUTING.md [code]: https://github.com/ycm-core/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md [readme]: https://github.com/ycm-core/YouCompleteMe/blob/master/README.md [faq]: https://github.com/ycm-core/YouCompleteMe/wiki/FAQ [search]: https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fgithub.com%2Fycm-core%2FYouCompleteMe%2Fissues%20python%20mac [gist]: https://gist.github.com/
bstaletic commented 2 months ago

Can you share your extra conf? Also, the clangd stderr log would be useful.

I have used YCM with c++20 and things worked, so it can definitely work.

cbtxs commented 2 months ago

This is my .ycm_extra_conf.py:

from distutils.sysconfig import get_python_inc
import sys
import platform
import os
import os.path as p
import subprocess

# 将 YCM 安装路径替换为实际路径
ycm_path = os.path.expanduser("~/.vim/bundle/YouCompleteMe/third_party/ycmd")

# 将路径添加到 sys.path
if ycm_path not in sys.path:
    sys.path.append(ycm_path)

import ycm_core

version = subprocess.getoutput("gcc --version | head -n1 | awk '{print $NF}'")
major_version = version.split('.')[0]

home_dir = os.path.expanduser("~")
local = os.path.join(home_dir, '.local')

result = subprocess.run(["mpicc", "--showme:incdirs"], stdout=subprocess.PIPE)
mpi_include = result.stdout.decode().strip().split(' ')[-1]

DIR_OF_THIS_SCRIPT = p.abspath(p.dirname(__file__))
DIR_OF_THIRD_PARTY = p.join(DIR_OF_THIS_SCRIPT, 'third_party')
SOURCE_EXTENSIONS = ['.cpp', '.cxx', '.cc', '.c', '.m', '.mm', '.inl']

library_include_paths = {
    'vtk': os.path.join(local, 'vtk', 'include', 'vtk-9.2'),
    'gmsh': os.path.join(local, 'include'),
    'mfem': os.path.join(local, 'mfem', 'include'),
    'cgal': os.path.join(local, 'cgal', 'include'),
    'googletest': os.path.join(local, 'googletest', 'include')
}

include_flags = [item for path in library_include_paths.values() for item in ('-I', path)]
flags = [
    '-Wall',
    '-Wextra',
    '-Werror',
    '-std=c++20',
    '-isystem',
    '-x', 'c++',
    '-isystem', get_python_inc(),
    '-isystem', '/usr/include/x86_64-linux-gnu/c++/' + major_version,
    '-isystem', '/usr/include/c++/' + major_version,
    '-isystem', ' /usr/include/c++/' + major_version + '/backward',
    '-isystem', '/usr/lib/gcc/x86_64-linux-gnu/' + major_version + '/include',
    '-isystem', '/usr/include',
    '-isystem', '/usr/include/cairomm-1.0',
    '-isystem', '/usr/include/cairo',
    '-isystem', '/usr/include/glib-2.0',
    '-isystem', '/usr/include/harfbuzz',
    '-isystem', '/usr/include/gtk-3.0',
    '-isystem', '/usr/include/atk-1.0',
    '-isystem', '/usr/include/freetype2',
    '-isystem', '/usr/include/gdk-pixbuf-2.0',
    '-isystem', '/usr/include/pango-1.0',
    '-isystem', '/usr/include/sigc++-2.0',
    '-isystem', '/usr/lib/x86_64-linux-gnu/glib-2.0/include',
    '-isystem', '/usr/lib/x86_64-linux-gnu/cairomm-1.0/include',
    '-isystem', '/usr/lib/x86_64-linux-gnu/sigc++-2.0/include',
    '-isystem', '/usr/lib/gcc/x86_64-linux-gnu/11/include',
    '-isystem', '/usr/include/eigen3',
    '-isystem', '/usr/local/include',
    '-isystem', mpi_include,
    '-I', '/usr/lib/x86_64-linux-gnu/openmpi/include/',
    '-I', './include',
    '-I', './thirdparty/include',
] + include_flags

def FlagsForFile(filename, **kwargs):
    extension = os.path.splitext(filename)[1]
    if extension in SOURCE_EXTENSIONS:
        final_flags = flags
    else:
        final_flags = []

    return {
        'flags': final_flags,
        'do_cache': True
    }

compilation_database_folder = ''

if p.exists( compilation_database_folder ):
  database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
  database = None

def IsHeaderFile( filename ):
  extension = p.splitext( filename )[ 1 ]
  return extension in [ '.h', '.hxx', '.hpp', '.hh' ]

def FindCorrespondingSourceFile( filename ):
  if IsHeaderFile( filename ):
    basename = p.splitext( filename )[ 0 ]
    for extension in SOURCE_EXTENSIONS:
      replacement_file = basename + extension
      if p.exists( replacement_file ):
        return replacement_file
  return filename

def PathToPythonUsedDuringBuild():
  try:
    filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' )
    with open( filepath ) as f:
      return f.read().strip()
  # We need to check for IOError for Python 2 and OSError for Python 3.
  except ( IOError, OSError ):
    return None

def Settings( **kwargs ):
  language = kwargs[ 'language' ]

  if language == 'cfamily':
    # If the file is a header, try to find the corresponding source file and
    # retrieve its flags from the compilation database if using one. This is
    # necessary since compilation databases don't have entries for header files.
    # In addition, use this source file as the translation unit. This makes it
    # possible to jump from a declaration in the header file to its definition
    # in the corresponding source file.
    filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] )

    if not database:
      return {
        'flags': flags,
        'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT,
        'override_filename': filename
      }

    compilation_info = database.GetCompilationInfoForFile( filename )
    if not compilation_info.compiler_flags_:
      return {}

    # Bear in mind that compilation_info.compiler_flags_ does NOT return a
    # python list, but a "list-like" StringVec object.
    final_flags = list( compilation_info.compiler_flags_ )

    # NOTE: This is just for YouCompleteMe; it's highly likely that your project
    # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
    # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
    try:
      final_flags.remove( '-stdlib=libc++' )
    except ValueError:
      pass

    return {
      'flags': final_flags,
      'include_paths_relative_to_dir': compilation_info.compiler_working_dir_,
      'override_filename': filename
    }

  if language == 'python':
    return {
      'interpreter_path': PathToPythonUsedDuringBuild()
    }

  return {}

def GetStandardLibraryIndexInSysPath( sys_path ):
  for index, path in enumerate( sys_path ):
    if p.isfile( p.join( path, 'os.py' ) ):
      return index
  raise RuntimeError( 'Could not find standard library path in Python path.' )

def PythonSysPath( **kwargs ):
  sys_path = kwargs[ 'sys_path' ]

  interpreter_path = kwargs[ 'interpreter_path' ]
  major_version = subprocess.check_output( [
    interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
  ).rstrip().decode( 'utf8' )

  sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
                   p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) )
  sys_path[ 0:0 ] = [ p.join( DIR_OF_THIS_SCRIPT ),
                      p.join( DIR_OF_THIRD_PARTY, 'bottle' ),
                      p.join( DIR_OF_THIRD_PARTY, 'cregex',
                              'regex_{}'.format( major_version ) ),
                      p.join( DIR_OF_THIRD_PARTY, 'frozendict' ),
                      p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ),
                      p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ),
                      p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ),
                      p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ),
                      p.join( DIR_OF_THIRD_PARTY, 'requests_deps',
                                                  'urllib3',
                                                  'src' ),
                      p.join( DIR_OF_THIRD_PARTY, 'requests_deps',
                                                  'chardet' ),
                      p.join( DIR_OF_THIRD_PARTY, 'requests_deps',
                                                  'certifi' ),
                      p.join( DIR_OF_THIRD_PARTY, 'requests_deps',
                                                  'idna' ),
                      p.join( DIR_OF_THIRD_PARTY, 'waitress' ) ]

  return sys_path

Additionally, I don't know what "the clangd stderr log" is. I ran the command YcmToggleLogs and got the following options:

Which logfile do you wish to open (or close if already open)?
1: clangd_stderrl54d2fhs.log
2: ycm_zz722j7l.log
3: ycmd_41095_stderr_ikqsbwaj.log
4: ycmd_41095_stdout_sk9q2hf7.log
Type number and <Enter> or click with the mouse (q or empty cancels):

I chose the first option and got the following file:

I[14:17:30.538] clangd version 9.0.0 (/home/vagrant/llvm/llvm-9.0.0.src/tools/clang 038587147cf2f97d1c3e677042f69560c65b5bea)
I[14:17:30.538] Working directory: /home/cbtxs/repository/HalfEdgeMesh
I[14:17:30.538] argv[0]: /home/cbtxs/repository/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
I[14:17:30.538] argv[1]: -header-insertion-decorators=0
I[14:17:30.538] argv[2]: -resource-dir=/home/cbtxs/repository/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/9.0.0
I[14:17:30.538] argv[3]: -limit-results=500
I[14:17:30.538] Starting LSP over stdin/stdout
I[14:17:30.539] <-- initialize(1)
I[14:17:30.542] --> reply:initialize(1) 3 ms
I[14:17:30.543] <-- initialized
I[14:17:30.543] unhandled notification initialized
I[14:17:30.543] <-- workspace/didChangeConfiguration
I[14:17:30.547] <-- workspace/didChangeConfiguration
I[14:17:30.547] Failed to find compilation database for /home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp
I[14:17:30.547] Enqueueing 1 commands for indexing
I[14:17:30.547] <-- textDocument/didOpen
E[14:17:30.547] Tried to create storage for empty directory!
I[14:17:30.548] Updating file /home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp with command 
[/home/cbtxs/repository/HalfEdgeMesh]
clang-tool -Wall -Wextra -Werror -std=c++17 -isystem -x c++ -isystem /usr/include/python3.10 -isystem /usr/include/x86_64-linux-gnu/c++/11 -isystem /usr/include/c++/11 -isystem  /usr/include/c++/11/backward -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include -isystem /usr/include -isystem /usr/include/cairomm-1.0 -isystem /usr/include/cairo -isystem /usr/include/glib-2.0 -isystem /usr/include/harfbuzz -isystem /usr/include/gtk-3.0 -isystem /usr/include/atk-1.0 -isystem /usr/include/freetype2 -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/pango-1.0 -isystem /usr/include/sigc++-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/lib/x86_64-linux-gnu/cairomm-1.0/include -isystem /usr/lib/x86_64-linux-gnu/sigc++-2.0/include -isystem /usr/lib/gcc/x86_64-linux-gnu/11/include -isystem /usr/include/eigen3 -isystem /usr/local/include -isystem /usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I /usr/lib/x86_64-linux-gnu/openmpi/include/ -I ./include -I ./thirdparty/include -I /home/cbtxs/.local/vtk/include/vtk-9.2 -I /home/cbtxs/.local/include -I /home/cbtxs/.local/mfem/include -I /home/cbtxs/.local/cgal/include -I /home/cbtxs/.local/googletest/include /home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp -fsyntax-only -resource-dir=/home/cbtxs/repository/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/9.0.0
I[14:17:30.994] Indexed /home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp (5965 symbols, 18299 refs, 186 files)
I[14:17:30.994] Failed to compile /home/cbtxs/repository/HalfEdgeMesh/test/test_range.cpp, index may be incomplete
I[14:17:31.041] --> textDocument/publishDiagnostics
I[14:18:58.292] <-- textDocument/hover(2)
I[14:18:58.293] --> reply:textDocument/hover(2) 0 ms
I[14:19:03.140] <-- textDocument/didClose
I[14:19:03.140] --> textDocument/publishDiagnostics
bstaletic commented 2 months ago

That extra conf is way overengineered.

If you want to just set -std=c++20, then just do so.

def Settings(**kwargs): return { 'flags': ['-std=c++20'] }
cbtxs commented 2 months ago

Thank you for your reply. I have resolved my issue. I hadn't installed the latest version of YouCompleteMe. I was simply using git pull to update, but it seems that wasn't enough. I deleted and reinstalled YCM using the command:

python3 install.py --clangd-completer

Now it is working correctly.

Additionally, regarding the issue of redundant information in the extra conf file that you mentioned, I will address it soon. Thank you for your support.

bstaletic commented 2 months ago

That makes sense. YCM uses submodules, so just pulling does not pull submodules. In the future you can juzt use git submodule update --init --recursive to update submodules. To get a new clangd, you also need to rerun install.py

cbtxs commented 2 months ago

OK, Thanks