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

Project can be built but IntelliSense cannot find the definitions #8

Open
mulleandreas opened this issue Jun 23, 2022 · 6 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@mulleandreas
Copy link

I have multiple projects that compile flawlessly, but IntelliSense detects multiple issues. The error messages point in the direction that IntelliSense cannot find the definitions. If I change the order of the includes, IntelliSense can resolve them. I broke one of the projects down to a minimum sample and checked the includes and I'm quite sure that there are no issues with them.

Also, if I re-add the previously used c_cpp_properties.json file to the project and remove the line "C_Cpp.default.configurationProvider": "iarsystems.iar-build" from the settings.json file, IntelliSense works regardless of the order of the includes and detects no errors.
c_cpp_properties.json.txt

This issue might be related to Incorrect intellisense configuration #6.

I would also be happy to provide the sample project privately.

IAR Build Log

[23.6.2022, 14:58:29][Debug] Activating extension
[23.6.2022, 14:58:29][Debug] Collected 5 toolchains
[23.6.2022, 14:58:29][Debug] Toolchain: selected 'Embedded Workbench 9.1 (Arm)' (index 3)
[23.6.2022, 14:58:29][Debug] Loading thrift workbench 'Embedded Workbench 9.1 (Arm)'...
[23.6.2022, 14:58:29][Debug] 4 new toolchain(s) added
[23.6.2022, 14:58:29][Debug] Found 3 project(s) in the workspace
[23.6.2022, 14:58:29][Debug] Project: selected 'bootloader-ra6m5' (index 0)
[23.6.2022, 14:58:29][Debug] Configuration: selected 'Debug' (index 0)
[23.6.2022, 14:58:29][Debug] Generating intellisense config for 'bootloader-ra6m5':'Debug'...
[23.6.2022, 14:58:29][Debug] Loaded thrift workbench 'Embedded Workbench 9.1 (Arm)'
[23.6.2022, 14:58:29][Debug] Loading project 'bootloader-ra6m5' using thrift...
[23.6.2022, 14:58:29][Debug] Loading project context for 'bootloader-ra6m5'
[23.6.2022, 14:58:29][Debug] Loading project 'bootloader-ra6m5' using thrift...
[23.6.2022, 14:58:30][Debug] Intellisense config changed. Notifying cpptools.
[23.6.2022, 14:58:30][Debug] Providing intellisense configuration(s) for: c:\Projekte\test\src\main.cpp

IAR Config Generator Log

Generating compilation database...

     IAR Command Line Build Utility V9.1.1.9611
     Copyright 2002-2022 IAR Systems AB.

bootloader-ra6m5 - Debug
Build description written to C:\Users\102-anmu\AppData\Local\Temp\iar-jsondbabcda958c3e05e627317c4b1d245b754.json

Done!
Generating intellisense information for c:\Projekte\test\src\main.cpp

C/C++ Extension Log

c_cpp_extension_log.log

@mulleandreas mulleandreas changed the title Buildable project but IntelliSense detects multiple errors depending on order of includes Project can be built but IntelliSense cannot find the definitions Jun 23, 2022
@HampusAdolfsson HampusAdolfsson added the bug Something isn't working label Jun 27, 2022
@HampusAdolfsson HampusAdolfsson self-assigned this Jun 27, 2022
@HampusAdolfsson
Copy link
Collaborator

Hi,

This is probably a separate bug from #6. There is nothing that sticks out to me in the logs you provided, so if you could provide the project that would be very helpful. You can email it to me at:
[email protected]

@HampusAdolfsson
Copy link
Collaborator

This seems to be a problem with the parsing or caching of symbols, rather than with the configuration. I've reported the problem to cpptools:
microsoft/vscode-cpptools#9540

@JackHerRrer
Copy link

JackHerRrer commented Jul 28, 2022

I don't know if this will help, but i had similar issues because of the now deprecated "IAR For Visual Studio Code" package by pluyckx. Simply disabling it was not enough.
To solve the issue, I disabled both extensions and deleted every configuration related to both extensions in all the config files of the project (c_cpp_properties.json, iar-vsc.json, settings.json). Then, I re-enabled the official IAR extension. From that moment it started to work properly

@omisys
Copy link

omisys commented May 16, 2023

This is not an issue with cpptools. The issue is that only the folders that are set in either the additional include directories, Preinclude files or defines are being sent to the cpptools plugin as browse path. If your source(c) files are not in the same directory as the header files they will not be indexed. The source(c) files that are added to the IAR project should also be added to the browse path. If your project is setup like this:

proj/include
proj/src

And the proj/include folder is added to the include directories in the preprocessor, only the include files will be indexed. You can work around this problem by added the src folder to the include directories as well so it will be sent to cpptools. But I think this should be fixed in this addon.

The C files that are used in the project are known to the EWP file so it should be possible to add them to browse path as well. I don't have the TS knowledge to make a pull request but I hope @HampusAdolfsson can pick this up?

public provideBrowseInfo(): IntellisenseInfo { const config = this.workspaceIntellisenseInfo?.getBrowseInfo(); return { defines: config?.defines ?? [], includes: config?.includes ?? [], preincludes: config?.preincludes ?? [], }; }

@HampusAdolfsson
Copy link
Collaborator

@omisys Thanks a lot. We'll work on a fix in the extension.

@HampusAdolfsson
Copy link
Collaborator

As I wrote in #17, @omisys solution fixes that issue. However, this is not the same issue and it is unfortunately not fixed by adding source folders to the browse path (in fact the example I sent to the cpptools developers already has the correct browse path).

That means that this issue is still most likely a problem in cpptools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants