Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ intellisense extension is slow #12017

Closed
adam2farkas opened this issue Feb 26, 2024 · 21 comments
Closed

C/C++ intellisense extension is slow #12017

adam2farkas opened this issue Feb 26, 2024 · 21 comments
Assignees
Labels
Language Service more info needed The issue report is not actionable in its current state performance

Comments

@adam2farkas
Copy link

adam2farkas commented Feb 26, 2024

Environment

  • OS and Version: RedHat 8
  • VS Code Version: 1.86.2
  • C/C++ Extension Version: 1.19.4
  • If using SSH remote, specify OS of remote machine: RedHat 8

Bug Summary and Steps to Reproduce

Bug Summary:
It takes ages to parse the project when the IDE is started, however, it might be enough at first to parse the opened files and the ones that are related technically (seen by the compiler, eg. includes and dependencies defined by cmake). This slows down development as developers have to wait till the project is parsed. Before this point, the program has almost identical capabilities like Notepad.

Steps to reproduce:
Open a medium sized project.

Expected behavior:
Fast scan and proper suggestions.

Configuration and Logs

I was not able to find a c_cpp_properties.json file except for the schema file. I have no idea what logs can be helpful to this issue.

Other Extensions

No response

Additional context

No response

@sean-mcmanus sean-mcmanus self-assigned this Feb 28, 2024
@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state performance labels Feb 28, 2024
@sean-mcmanus
Copy link
Collaborator

@adam2farkas When you set C_Cpp.loggingLevel to "Debug" and repro the slowness, what type of logging do you see being output and/or when you hover over the {} C++ status icon in the bottom right what does say is processing?

@mojomojo52
Copy link

I'm seeing similar behavior across multiple linux distributions. No suggestions, very slow definition finding. Reverting back to a earlier version fixed this.

@adam2farkas
Copy link
Author

adam2farkas commented Mar 1, 2024

@mojomojo52 Can you tell me which extension did you downgrade and to what version?

@mojomojo52
Copy link

I downgraded C/C++ for Visual Studio Code from v1.19.4 to v1.18.5.

@Colengms
Copy link
Collaborator

Colengms commented Mar 1, 2024

To investigate this, we could really use the debug output Sean asked for above. There are many things this could be. For instance, 1.19.4 made a database change, which will cause reindexing. Once re-indexing is complete, performance should return to normal. 1.19.4 also introduced progressive IntelliSense updating, which updates IntelliSense in small portions at a time, which should actually result in a significant apparent performance improvement, as squiggles and colorization will appear much more quickly for the visible portion of the code and allow other requests to occur mid-update rather than waiting for the full update to complete before processing the next operation. 1.19.4 will also keep all visible sources up to date with IntelliSense instead of only a single active document. It's also possible a specific operation, perhaps even a new feature, is taking longer than expected and delaying processing of other operations in queue. Without a debug log, we can only guess. This doesn't appear to be a general problem impacting everyone, so there would seem to be something about the repro conditions we would need more information about to investigate further.

@av4625
Copy link

av4625 commented Mar 3, 2024

This might be related to this #12051 although mine never completes so is worse than slow! Downgrading fixes mine too.

@Anguimru
Copy link

Anguimru commented Mar 4, 2024

This is happening to me also, downgrading to v1.18.5 seems to solve the issue

OS and Version: Windows 11
VS Code Version: 1.87.0
C/C++ Extension Version: 1.19.4
If using SSH remote, specify OS of remote machine: WSL-1 Ubuntu-22.04

Here's the Debug output, some part were cut because output is too long

loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.4
cpptools version (native): 1.19.4.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Warning: Client version check failed. Recreating database.
[rc=0x80004005] (DB: v3, Expected: v4)
initializing full-text search tables
populating full-text search tables
enabling full-text triggers
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/gcc -x c++ -E -dM /dev/null
Detected language standard version: gnu++14
Querying compiler's default target using command line: "/usr/bin/gcc" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/gcc -std=gnu++17 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc'
Compiler query command line: /usr/bin/gcc -std=gnu17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc'
Compiler query command line: /usr/bin/gcc -g -fsanitize=integer-divide-by-zero -fsanitize=signed-integer-overflow -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -std=gnu++17 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc'
Compiler query command line: /usr/bin/gcc -g -fPIC -fsanitize=integer-divide-by-zero -fsanitize=signed-integer-overflow -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -std=gnu++17 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc'
  Folder: /usr/include/ will be indexed
  Folder: /usr/lib/gcc/x86_64-linux-gnu/10/include/ will be indexed
  Folder: /usr/local/include/ will be indexed
  Folder: /usr/local/include/opencv4/ will be indexed
  Folder: /usr/local/include/ncnn/ will be indexed
  Folder: /usr/local/include/libcamera/ will be indexed
  Folder: /usr/include/x86_64-linux-gnu/ will be indexed
  Folder: /usr/include/c++/10/ will be indexed
  Folder: /mnt/c/xxx/xxx/xxx/ will be indexed
LSP: Sending response (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 3)
Discovering files...
  Processing folder (recursive): /usr/include/
Querying compiler for default C++ language standard using command line: /usr/bin/clang -x c++ -E -dM /dev/null
Detected language standard version: c++14
Querying compiler's default target using command line: "/usr/bin/clang" -dumpmachine
Compiler returned default target value: x86_64-pc-linux-gnu
Compiler query command line: /usr/bin/clang -std=c17 -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
Compiler query command line: /usr/bin/clang -std=c++14 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
LSP: Sending response (id: 3)
LSP: (received) cpptools/didChangeCppProperties (id: 4)
LSP: (invoked) cpptools/didChangeCppProperties (id: 4)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: Sending response (id: 4)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///mnt/c/xxx/xxx/xxx/xxx.cc
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) textDocument/didOpen: file:///mnt/c/xxx/xxx/xxx/xxx.cc
LSP: (invoked) cpptools/didChangeVisibleTextEditors
  tag parsing file: /mnt/c/xxx/xxx/xxx/xxx.cc
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 5)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 6)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 7)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 5)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 8)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc(id: 7)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 9)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 10)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 9)
LSP: (received) cpptools/clearCustomConfigurations
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 5)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 6)
Intellisense update pending for: file:///mnt/c/xxx/xxx/xxx/xxx.cc
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 6)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 8)
LSP: Sending response (id: 8)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 10)
LSP: (invoked) cpptools/clearCustomConfigurations
LSP: Sending response (id: 10)
LSP: Sending response (id: 7)
LSP: Sending response (id: 9)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/xxx/xxx.cc
sending compilation args for /mnt/c/xxx/xxx/xxx/xxx.cc
  include: /mnt/c/xxx/xxx/xxx/include
  include: /usr/local/include/libcamera
  include: /usr/local/include/ncnn
  include: /usr/local/include/opencv4
  include: /usr/include/c++/10
  include: /usr/include/x86_64-linux-gnu/c++/10
  include: /usr/include/c++/10/backward
  include: /usr/lib/gcc/x86_64-linux-gnu/10/include
  include: /usr/local/include
  include: /usr/include/x86_64-linux-gnu
  include: /usr/include
  define: __SSP_STRONG__=3
  define: __DBL_MIN_EXP__=(-1021)
  define: __UINT_LEAST16_MAX__=0xffff
  define: __ATOMIC_ACQUIRE=2
  define: __FLT_MIN__=1.17549435082228750796873653722224568e-38F
  define: __GCC_IEC_559_COMPLEX=2
  define: __INTMAX_C(c)=c ## L
  define: __CHAR_BIT__=8
  define: __WCHAR_MAX__=0x7fffffff
  define: __UINT8_MAX__=0xff
  
  ** LOTS OF **
 tag parsing file: /usr/include/x86_64-linux-gnu/bits/types.h
  tag parsing file: /usr/include/linux/stddef.h
    tag parsing error (this can be ignored unless symbols can't be found):
    line 26 (col. 49): error: expected a ')'
  tag parsing file: /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
  tag parsing file: /usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h
  tag parsing file: /usr/include/x86_64-linux-gnu/bits/confname.h
  tag parsing file: /usr/include/x86_64-linux-gnu/bits/getopt_posix.h
  tag parsing file: /usr/include/x86_64-linux-gnu/bits/unistd_ext.h
  tag parsing file: /usr/include/x86_64-linux-gnu/asm/unistd_32.h
  tag parsing file: /usr/include/x86_64-linux-gnu/asm/unistd_x32.h
** MORE UNTIL **

Done parsing open files.
LSP: Sending response (id: 17)
  tag parsing file: /mnt/c/xxx/xxx/xxx//build/CMakeFiles/3.20.2/CompilerIdC/CMakeCCompilerId.c
  tag parsing file: /mnt/c/xxx/xxx/xxx//build/CMakeFiles/3.20.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
  tag parsing file: /mnt/c/xxx/xxx/xxx/xxx.h
  tag parsing file: /usr/local/include/ncnn/layer.h
  tag parsing file: /usr/local/include/cryptopp/network.h
  tag parsing file: /usr/include/pcl-1.12/pcl/surface/3rdparty/poisson4/mat.h
  tag parsing file: /usr/local/include/ncnn/mat.h
  tag parsing file: /usr/local/include/ncnn/modelbin.h
  tag parsing file: /usr/local/include/ncnn/option.h
  tag parsing file: /usr/local/include/ncnn/paramdict.h
  tag parsing file: /usr/include/pcl-1.12/pcl/apps/point_cloud_editor/command.h
  tag parsing file: /usr/local/include/ncnn/command.h
  tag parsing file: /usr/local/include/ncnn/pipeline.h
  tag parsing file: /usr/local/include/cryptopp/filters.h
  tag parsing file: /usr/local/include/cryptopp/hrtimer.h
  tag parsing file: /usr/local/include/cryptopp/stdcpp.h
  tag parsing file: /usr/include/pcl-1.12/pcl/surface/3rdparty/poisson4/geometry.h
  tag parsing file: /usr/include/pcl-1.12/pcl/outofcore/visualization/geometry.h
  tag parsing file: /usr/include/pcl-1.12/pcl/common/geometry.h
  tag parsing file: /usr/include/pcl-1.12/pcl/surface/3rdparty/poisson4/mat.hpp
  tag parsing file: /usr/include/boost/qvm/mat.hpp
  tag parsing file: /usr/local/include/opencv4/opencv2/gapi/own/mat.hpp
  tag parsing file: /usr/lib/llvm-14/lib/clang/14.0.0/include/riscv_vector.h
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 20)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 20)
LSP: $/cancelRequest (textDocument/hover, id: 20)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 21)
LSP: $/cancelRequest (textDocument/hover, id: 21)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 21)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 22)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 22)
LSP: Sending response (id: 22)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 23)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx/xxx.cc (id: 23)
LSP: $/cancelRequest (textDocument/hover, id: 23)
  tag parsing file: /usr/include/x86_64-linux-gnu/libavutil/cpu.h
  tag parsing file: /usr/local/include/cryptopp/cpu.h
  tag parsing file: /usr/local/include/ncnn/cpu.h

** THEN IT GOES AGAIN WITH MORE **
tag parsing file: /usr/include/boost/lambda/detail/arity_code.hpp
  tag parsing file: /usr/include/boost/lambda/detail/actions.hpp
  tag parsing file: /usr/include/boost/lambda/detail/lambda_traits.hpp
  tag parsing file: /usr/include/boost/lambda/detail/function_adaptors.hpp
  tag parsing file: /usr/include/boost/lambda/detail/return_type_traits.hpp
  tag parsing file: /usr/include/boost/lambda/detail/select_functions.hpp
  tag parsing file: /usr/include/boost/lambda/detail/lambda_functor_base.hpp
  tag parsing file: /usr/include/boost/lambda/detail/lambda_functors.hpp
  tag parsing file: /usr/include/boost/lambda/detail/ret.hpp
  tag parsing file: /usr/include/boost/type_traits/object_traits.hpp
tag parsing file: /usr/include/boost/units/base_units/si/meter.hpp
    tag parsing error (this can be ignored unless symbols can't be found):
    line 41 (col. 1): error: expected a file name
  tag parsing file: /usr/include/boost/units/base_units/si/kilogram.hpp
  tag parsing file: /usr/include/boost/units/base_units/si/second.hpp
    tag parsing error (this can be ignored unless symbols can't be found):
    line 40 (col. 1): error: expected a file name
*************

*** UNTIL.... ****
tag parsing file: /usr/include/xercesc/util/KeyRefPair.c
  tag parsing file: /usr/include/xercesc/util/KeyRefPair.hpp
  tag parsing file: /usr/include/xercesc/util/Janitor.c
  Parsing: 11913 files(s) processed
Done parsing remaining files.
Database safe to open.

`

Then I open another .cc file and

`
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file://mnt/c/xxx/xxx/xxx.cc (id: 24)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 24)
LSP: Sending response (id: 24)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 25)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 25)
LSP: Sending response (id: 25)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc(id: 26)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc (id: 26)
LSP: Sending response (id: 26)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///mnt/c/xxx/xxx/main.cc
LSP: (invoked) textDocument/didOpen: file:///mnt/c/xxx/xxx/main.cc
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/main.cc
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/main.cc
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/main.cc(id: 27)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/main.cc (id: 28)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/main.cc (id: 28)
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/main.cc
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/main.cc (id: 27)
LSP: Sending response (id: 27)
LSP: (invoked) cpptools/didChangeTextEditorSelection
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/main.cc (id: 29)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/main.cc (id: 29)
LSP: Sending response (id: 29)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/main.cc (id: 30)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/main.cc (id: 31)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/main.cc (id: 30)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/main.cc (id: 31)
sending compilation args for /mnt/c/xxx/xxx/main.cc
  include: /mnt/c/xxx/xxx/include
  include: /usr/local/include/libcamera
  include: /usr/local/include/ncnn
  include: /usr/local/include/opencv4
  include: /usr/include/c++/10
  include: /usr/include/x86_64-linux-gnu/c++/10
  include: /usr/include/c++/10/backward
  include: /usr/lib/gcc/x86_64-linux-gnu/10/include
  include: /usr/local/include
  include: /usr/include/x86_64-linux-gnu
  include: /usr/include
  define: __SSP_STRONG__=3
  define: __DBL_MIN_EXP__=(-1021)
  define: __UINT_LEAST16_MAX__=0xffff
  define: __ATOMIC_ACQUIRE=2
 ** LOT OF DEFINES **
  define: __FLT128_DECIMAL_DIG__=36
  define: __GCC_ATOMIC_LLONG_LOCK_FREE=2
  define: __FLT32_HAS_QUIET_NAN__=1
  define: __FLT_DECIMAL_DIG__=9
  define: __UINT_FAST16_MAX__=0xffffffffffffffffUL
  define: __LDBL_NORM_MAX__=1.18973149535723176502126385303097021e+4932L
  define: __GCC_ATOMIC_SHORT_LOCK_FREE=2
  define: __UINT_FAST8_TYPE__=unsigned char
  define: _GNU_SOURCE=1
  define: __ATOMIC_ACQ_REL=4
  define: BOOST_ALL_DYN_LINK
  define: BOOST_ALL_NO_LIB
  define: BOOST_ATOMIC_DYN_LINK
  define: BOOST_CHRONO_DYN_LINK
  define: BOOST_CONTEXT_DYN_LINK
  define: BOOST_COROUTINE_DYN_LINK
  define: BOOST_DATE_TIME_DYN_LINK
  define: BOOST_FILESYSTEM_DYN_LINK
  define: BOOST_LOG_DYN_LINK
  define: BOOST_LOG_SETUP_DYN_LINK
  define: BOOST_RANDOM_DYN_LINK
  define: BOOST_REGEX_DYN_LINK
  define: BOOST_SERIALIZATION_DYN_LINK
  define: BOOST_SYSTEM_DYN_LINK
  define: BOOST_THREAD_DYN_LINK
  define: LEGACY_WS_DISABLED
  other: --g++
  other: --gnu_version=100500
  stdver: c++17
  intelliSenseMode: linux-gcc-x64
LSP: Sending response (id: 30)
LSP: Sending response (id: 28)
LSP: Sending response (id: 31)
Update IntelliSense time (sec): 18.347
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/main.cc (id: 32)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/main.cc (id: 32)
LSP: Sending response (id: 32)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 33)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 33)
LSP: Sending response (id: 33)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 34)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 34)
LSP: Sending response (id: 34)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 35)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/main.cc (id: 35)
LSP: Sending response (id: 35)

`

Then starts scanning again when I navigate my source code, tooltips begin to show Loading... and Instellisense appears updating

`Update IntelliSense time (sec): 12.454
LSP: (invoked) textDocument/definition: file:///mnt/c/xxx/xxx/xxx.cc (id: 70)
LSP: $/cancelRequest (cpptools/getFoldingRanges, id: 69)
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 69)
LSP: Sending response (id: 70)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///mnt/c/xxx/xxx/xxx.h
LSP: (invoked) textDocument/didOpen: file:///mnt/c/xxx/xxx/xxx.h
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/xxx.cc (id: 71)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/xxx.cc (id: 71)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 71)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/xxx.h
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.h (id: 72)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.h (id: 73)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.h (id: 73)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.h (id: 74)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 72)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.h (id: 75)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.h (id: 76)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.h (id: 76)
LSP: $/cancelRequest (cpptools/getFoldingRanges, id: 75)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 74)
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 73)
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 76)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/xxx.cc (id: 77)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 77)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 78)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/xxx.cc (id: 79)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 78)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.h (id: 72)
Intellisense update pending for: file:///mnt/c/xxx/xxx/xxx.h
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.h (id: 74)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.h (id: 75)
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 77)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 75)
Intellisense update pending for: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/xxx.cc
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 78)
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/xxx.cc (id: 79)
LSP: Sending response (id: 79)
Shutting down IntelliSense server: /mnt/c/xxx/xxx/xxx/config.cc
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 80)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 81)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.cc (id: 82)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/xxx.cc (id: 82)
LSP: Sending response (id: 82)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/xxx.cc (id: 80)
LSP: Sending response (id: 80)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 81)
LSP: Sending response (id: 81)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/xxx.cc
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/xxx.h
Populating file name cache...
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc (id: 83)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc (id: 83)
LSP: $/cancelRequest (textDocument/hover, id: 83)
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc (id: 84)
LSP: $/cancelRequest (textDocument/hover, id: 84)
Done populating filename cache. Elapsed time: 4667 ms
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/xxx.cc (id: 84)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 85)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 85)
LSP: Sending response (id: 85)
Update IntelliSense time (sec): 22.485
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 86)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/xxx.cc (id: 86)
LSP: Sending response (id: 86)
`

As you can see for example, last intellisense update took 22s on an SSD and with WSL 1, which has faster access to the host filesystem than WSL2. After a bit even Go to Definition (F12) stop working

Hope that helps

@Colengms
Copy link
Collaborator

Colengms commented Mar 4, 2024

Hi @AndreGuimRua . Can you confirm what you're experiencing that is slower? Note that the Update IntelliSense time (sec) is the total time to update IntelliSense for the full file, but 1.19.5 will update the currently visible region much more quickly (about half of the original update time), and refresh the rest in the background. That total number is actually expected to be a bit larger, as it includes additional work to break up the IntelliSense pass into chunks.

In 1.19.5, we also addressed a bug in which IntelliSense was not properly being delayed/deferred while typing. Some users have reported this ~1 second delay after typing as a perf issue, but it's actually intentional. This means that as you are typing actively, no update will be taking place against your incomplete code. That is not because IntelliSense is running more slowly.
You can adjust that delay with the C_Cpp.intelliSenseUpdateDelay setting.

Another possible perf issue with 1.19.5 may be a VS Code bug in which we sometime receive several hundred requests for folding ranges. We're in the process of investigating this. If you are seeing this issue, you might see Redundant folding ranges request received logged, in the console under Help -> Toggle Developer Tools.

@Anguimru
Copy link

Anguimru commented Mar 5, 2024

Hi @Colengms , When I talk about IntelliSense being slow, is >1 second (it wouldn't be an issue for me otherwise).
I'm seeing [Extension Host] Redundant folding ranges request received for: as you said but something interesting happened.
I've downgraded yesterday to v1.18.5 which solved the issue, then went back to v1.19.5 to provide additional info on this issue. As far I've been using VSCode with v1.19.5 with no issues so far. IntelliSense seems that's keeping up with the changes without being slowed. Same kind of logging on the C/C++ extension console and a few [Extension Host] Redundant folding ranges request received for:
I'll try to keep you updated with this but looks promising

@Anguimru
Copy link

Anguimru commented Mar 5, 2024

After a while, issues arise again. I have a some .h files in the same folder, like config.h and utilities.h

#ifndef CONFIG_H
#define CONFIG_H

#include <iostream>
#include <functional>
#include <string>
#include <queue>

#include "utilities.h"

#endif // CONFIG_H

After a while, when I click over utilities.h and press F12 to go to the definition. It takes 20s to open the utilities.h file (it's in the same folder)
This is the output:

LSP: Sending response (id: 618)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/utilities.h (id: 619)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/utilities.h (id: 619)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 620)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 620)
LSP: Sending response (id: 619)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/utilities.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/utilities.h (id: 621)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/utilities.h (id: 621)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 622)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 622)
LSP: Sending response (id: 621)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/utilities.h
LSP: Sending response (id: 620)
LSP: Sending response (id: 622)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didClose: file:///mnt/c/xxx/xxx/utilities.h
LSP: (invoked) textDocument/didClose: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 623)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 623)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 623)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 624)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 625)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 624)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 626)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 627)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 627)
LSP: (received) textDocument/definition: file:///mnt/c/xxx/xxx/config.h (id: 628)
LSP: Sending response (id: 627)
Update IntelliSense time (sec): 62.225
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 624)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/config.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 625)
LSP: Sending response (id: 625)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 626)
LSP: (invoked) textDocument/definition: file:///mnt/c/xxx/xxx/config.h (id: 628)
LSP: Sending response (id: 628)
LSP: Sending response (id: 626)
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 629)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 629)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 629)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///mnt/c/xxx/xxx/utilities.h
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (invoked) textDocument/didOpen: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 630)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 630)
LSP: Sending response (id: 630)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/utilities.h (id: 631)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/utilities.h (id: 631)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 632)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 632)
LSP: Sending response (id: 631)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/utilities.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/utilities.h
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/utilities.h (id: 633)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 634)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/utilities.h (id: 633)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/utilities.h (id: 634)
LSP: Sending response (id: 633)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/utilities.h
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/config.h
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 632)
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 634)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 635)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 635)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 635)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 636)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 637)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 636)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 637)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 638)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 639)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 640)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 640)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: $/cancelRequest (cpptools/getCodeActions, id: 638)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 641)
LSP: Sending response (id: 640)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 642)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 641)
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 643)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 643)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: $/cancelRequest (cpptools/getCodeActions, id: 642)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 644)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 645)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 644)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 636)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 637)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 638)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 639)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 641)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 642)
LSP: Sending response (id: 639)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/config.h (id: 643)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 644)
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 645)
LSP: Sending response (id: 645)
Update IntelliSense time (sec): 44.516
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/config.h
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 646)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 646)
Update IntelliSense time (sec): 0.029
LSP: Sending response (id: 646)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 647)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 647)
LSP: Sending response (id: 647)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/comm.h (id: 648)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/comm.h (id: 648)
LSP: Sending response (id: 648)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/comm.h
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/comm.h
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/comm.h
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/comm.h (id: 649)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/comm.h (id: 649)
LSP: Sending response (id: 649)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/comm.h (id: 650)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/comm.h (id: 650)
LSP: Sending response (id: 650)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/comm.h (id: 651)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/comm.h (id: 651)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/comm.h (id: 652)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/comm.h (id: 652)
LSP: Sending response (id: 651)
LSP: Sending response (id: 652)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/comm.h
LSP: (received) textDocument/hover: file:///mnt/c/xxx/xxx/comm.h (id: 653)
LSP: (invoked) textDocument/hover: file:///mnt/c/xxx/xxx/comm.h (id: 653)
LSP: $/cancelRequest (textDocument/hover, id: 653)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/comm.h (id: 654)
LSP: $/cancelRequest (textDocument/documentHighlight, id: 654)
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 655)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 656)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 655)
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 657)
LSP: (received) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 658)
LSP: (invoked) cpptools/getDocumentSymbols: file:///mnt/c/xxx/xxx/config.h (id: 658)
LSP: Sending response (id: 658)
LSP: (invoked) textDocument/documentHighlight: file:///mnt/c/xxx/xxx/comm.h (id: 654)
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 655)
Update IntelliSense time (sec): 15.001
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///mnt/c/xxx/xxx/config.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///mnt/c/xxx/xxx/config.h
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getCodeActions: file:///mnt/c/xxx/xxx/config.h (id: 656)
LSP: Sending response (id: 656)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 657)
LSP: $/cancelRequest (cpptools/getFoldingRanges, id: 657)
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 657)
IntelliSense update scheduled and TU acquisition started for: file:///mnt/c/xxx/xxx/config.h
Update IntelliSense time (sec): 0.033
LSP: (received) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 659)
LSP: (invoked) cpptools/getFoldingRanges: file:///mnt/c/xxx/xxx/config.h (id: 659)
LSP: Sending response (id: 659)

When the first 'LSP: Sending response (id: 618)' appears, it remains there for a few seconds, then the other info is printed.

In the dev console only this appears:

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
u @ dom.ts:143
o @ dom.ts:164
P @ selectBoxCustom.ts:232
u @ selectBoxCustom.ts:142
p @ selectBox.ts:91
l @ actionViewItems.ts:441
P @ menuEntryActionViewItem.ts:494
j @ instantiationService.ts:119
createInstance @ instantiationService.ts:85
M @ menuEntryActionViewItem.ts:523
getActionViewItem @ viewPane.ts:673
actionViewItemProvider @ viewPane.ts:435
actionViewItemProvider @ toolbar.ts:105
(anonymous) @ actionbar.ts:362
push @ actionbar.ts:353
(anonymous) @ toolbar.ts:201
setActions @ toolbar.ts:200
setActions @ toolbar.ts:182
Rb @ viewPane.ts:642
Tb @ viewPane.ts:656
(anonymous) @ viewPane.ts:375
y @ event.ts:1127
fire @ event.ts:1158
(anonymous) @ actions.ts:84
y @ event.ts:1127
fire @ event.ts:1158
n @ actions.ts:48
(anonymous) @ actions.ts:38
y @ event.ts:1127
fire @ event.ts:1158
resume @ event.ts:1306
(anonymous) @ event.ts:1345

Hope any of this info helps

Copy link

github-actions bot commented Apr 7, 2024

Hey @sean-mcmanus, this issue might need further attention.

@adam2farkas, you can help us out by closing this issue if the problem no longer exists, or adding more information.

@thennothinghappened
Copy link

I downgraded C/C++ for Visual Studio Code from v1.19.4 to v1.18.5.

This has also fixed it for me immediately.

@Colengms
Copy link
Collaborator

Hi @Anguinru

When I talk about IntelliSense being slow, is >1 second (it wouldn't be an issue for me otherwise).

By default, IntelliSense won't start updating within 1 second. There is an intentional delay of 1 second after editing before an IntelliSense pass occurs. We get perhaps as many requests for IntelliSense not to refresh while typing, as we do for IntelliSense to start refreshing more quickly. That delay was actually "fixed" in 1.19.4:

From the release log:

Fix IntelliSense passes occurring while a user is still typing, instead of honoring the C_Cpp.intelliSenseUpdateDelay setting.

You can reduce or eliminate that delay by changing the value of the C_Cpp.intelliSenseUpdateDelay setting.

I'm seeing [Extension Host] Redundant folding ranges request received for

There was recently a bug in VS Code that resulted in this error and did indeed have a significant impact on perf until it was addressed in VS Code v1.88. The issue was microsoft/vscode#206841

Since your last repro was specifically with header files, if you are still seeing an issue, I suspect it may have something to do with newer versions of the Extension perhaps choosing different source files for header translations units. (When a header is opened, a source file that includes that header is actually chosen to host IntelliSense for that header). If you're still able to repro, could you provide the output of running the C/C++: Log Diagnostics command while that file is open and repro'ing an issue? That would provide us with details about how IntelliSense has been configured when your issue is reproing. (It's one of the things we ask for in our new issue template).

@thennothinghappened We're not currently tracking significant perf regressions between these versions. (At least not any we're gotten sufficient information on to reproduce). I'd highly recommend for anyone experiencing a perf issue to open a new GitHub issue (rather than assume another unidentified performance issue is a match) with the information requested in our new issue template. We've made several performance improvements recently, and I would be eager to collect actionable information on any reported performance regressions.

@thennothinghappened
Copy link

When I get a moment I'll have a look at what versions are affected specifically and/or if I'm on an outdated vscode. The issue on my end presents as two things:

  1. Go to definition is incredibly slow, sometimes taking a full minute before finding it. This goes for anything you can use it on, including just #includes of neighbouring files. Sometimes it completely fails.

  2. Semantic highlighting is incredibly slow to update, changing tokens might take an equally long time as go to definition did before they're coloured correctly.

Rolling back to 1.18.5 fixed both, but the latter was still noticably slow if now usable.

@thennothinghappened
Copy link

Alright, quick update. I've grabbed some videos of both versions.

v1.18.5

c_cpp.1.18.5.mov

v1.19.9

c_cpp.Latest.release.mov

Notably this is right after installing both, so both are on an equal playing field with caching anything. What I did notice was that v1.19.9 seemed to improve a bit over time - visiting the same file multiple times from a reference would be faster - it was still far slower than v1.18.5, and sometimes failed to find it.

I have confirmed I'm on the latest vscode (v1.88.1).

@seansovine
Copy link

seansovine commented May 1, 2024

Another data point here. When I load a large project with the 1.19.9 version, the editor responds slowly and the CPU fan starts running continuously. Looking at a system monitor, I see the cpptools process taking up 100% of one CPU. So perhaps one thread is hanging up. When I downgrade to 1.18.5 I don't have any problems, as others have said.

Unfortunately, this also happens with the pre-release version, 1.20.3, so I guess it's not yet fixed in the next update.

@sean-mcmanus
Copy link
Collaborator

@seansovine You should check the C/C++ language status or logging to see what is going on (or attaching a debugger and getting a call stack with 1.20.3). We have not reproed this internally yet and do no yet know what is causing it, so more information would help.

@seansovine
Copy link

@sean-mcmanus For one project I had a warning about the intellisense mode being changed. I realized I did not have a c_cpp_properties.json file for that project, so I created one using 'Select a configuration...', and just kept the default file that was generated by the command. This resolved that warning, and also seemed to resolve the slowness / high CPU activity issue as well. I'm testing on the 1.20.3 pre-release version.

I opened another large C++ project, that had no c_cpp_properties.json file, but also no messages from the C/C++ extension. I similarly created a default config file for this project using 'Select a configuration...'. After the extension finished scanning the project, the cpu activity returned to normal and the intellisense features seem to be working as expected.

So maybe the slowness / high CPU problem is just caused by having a bad configuration for the extension, and some change between 1.18.5 and the current release has caused this to have a more noticeable impact? In the past I seem to remember having this issue in projects where I had configured the C/C++ extension, not just ones where I had not done the config. Maybe in those cases I had the extension misconfigured somehow. I will report back if the problem shows up again.

@sean-mcmanus
Copy link
Collaborator

@seansovine We fixed some bugs in 1.20.x that could cause excessive CPU usage.

@sean-mcmanus
Copy link
Collaborator

@adam2farkas Oh, I just realized your original issue might not be fixed -- does your extension slowness issue still repro with 1.20.3 or newer?

@adam2farkas
Copy link
Author

adam2farkas commented May 3, 2024 via email

@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Language Service more info needed The issue report is not actionable in its current state performance
Projects
None yet
Development

No branches or pull requests

8 participants