Answer a question

I've been using VSCode for C language professionally almost everyday for +1 year. Right now, I hit with something that is really affecting my productivity.

When I open a big project, the features "Go to definition, Go to declaration, Peek..." etc don't work. I don't know how to describe how 'big' the project is. There are source files with +26k lines and it can take up to 45 min to compile. When I work with a more reasonably sized project, I have no issues, so until now I assumed this was a limitation of the program due to the size of my project and resigned myself. Now, I'm really bothered at this point and would like to find a solution.

What strikes me is that searching in the whole project (Ctrl + Shift + F) is blazing fast and works brilliantly, so VS seems to be capable of 'handling' this big project.

  • C/C++ extension from Microsoft last version v0.28.3
  • VSCode last version 1.46.1
  • Windows 10

Do you think there is a solution for this? Have you used VSCode with massive projects?

Edit: by 'don't work' I mean, it tries to perform the action but stays 'thinking' indefinitely.

Answers

Most propably it is not "Not working" but just "pretty slow". This is a known problem for C/C++ projects using the C/C++ extension for Visual studio code. The Indexer for intellisense needs some time (especially if you are not limiting it via limitSymbolsToIncludedHeaders or something like that). You could try reducing the amount of parsed files by using explizit browse paths in your c_cpp_properties.json like

"browse": {
  "path": [
    "/usr/include/",
    "/usr/local/include/",
    "${workspaceRoot}/../include",
    "${workspaceRoot}/dir1",
    "${workspaceRoot}/dir2",
    "${workspaceRoot}/dir3/src/c++",
    "${workspaceRoot}/dir5",
    "${workspaceRoot}/dir6/src",
    "${workspaceRoot}/dir7/src",
    "${workspaceRoot}/dir4"
],

and excluding for example IDE/SDK files where you do not need autocompletion/Go To Symbol/Go to definition.

For more explanation see: https://github.com/microsoft/vscode-cpptools/issues/1695

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐