GithubHelp home page GithubHelp logo

Include graph lookup should occur for source files as well as header files, when determining primary TU source file about vscode-cpptools HOT 7 CLOSED

Sochsenfeld avatar Sochsenfeld commented on May 27, 2024
Include graph lookup should occur for source files as well as header files, when determining primary TU source file

from vscode-cpptools.

Comments (7)

sean-mcmanus avatar sean-mcmanus commented on May 27, 2024

It's creating a new TU for the #included .cpp files instead of using main.cpp's TU. @Colengms Do you know anything about this?

It works in VS (with a project).

from vscode-cpptools.

Colengms avatar Colengms commented on May 27, 2024

This is because the C/C++ Extension will currently assume that a file with a source extension such as .cpp can be interpreted independently, not as a header of another source file. We could improve this for your scenario by always performing a (costly) lookup to detect this scenario, when opening any file instead of just those with header extensions. We can use this issue to track implementing that.

from vscode-cpptools.

Sochsenfeld avatar Sochsenfeld commented on May 27, 2024

That makes sense, but i am still confused as to why it worked before. I have used this style for projects for a few years now and it always worked. I only noticed that when i opened the files independently the lookup does not work. But when i opened my projects as a whole workspace or as the whole folder the lookup worked. That made sense to me and I always assumed it was an IntelliSense feature to notice things within the workspace and that the other source files are included in the main.cpp. Could there be an explanation why it worked before?

from vscode-cpptools.

sean-mcmanus avatar sean-mcmanus commented on May 27, 2024

@Colengms This is a 1.19.4 regression, i.e. it works correctly with 1.18.5. @Sochsenfeld You should be able to downgrade to 1.18.5 and it should work.

from vscode-cpptools.

Sochsenfeld avatar Sochsenfeld commented on May 27, 2024

Amazing, thank you! That works for now!

from vscode-cpptools.

FrankHB avatar FrankHB commented on May 27, 2024

@Colengms This is a 1.19.4 regression, i.e. it works correctly with 1.18.5. @Sochsenfeld You should be able to downgrade to 1.18.5 and it should work.

This also affects #include MACRO_NAME forms when the a file is included in the source (or the header file) designated by MACRO_NAME indirectly after macro expansion. However in this case the downgrade also does not work. The behavior is a slightly different: 1.18.5 would still generate further diagnostics about the failure on subsequent multiple #include MACRO_NAME lines, while 1.19.4 would only complain at the first line. Perhaps better a separate issue?

(NOTE: The value of includePath contains something like ${workspaceFolder}/**. Without ** there is no problem.)

from vscode-cpptools.

sean-mcmanus avatar sean-mcmanus commented on May 27, 2024

@Sochsenfeld @FrankHB Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.19.5

from vscode-cpptools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.