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

Incorrect intellisense configuration #6

Closed
nxj opened this issue Jun 22, 2022 · 7 comments
Closed

Incorrect intellisense configuration #6

nxj opened this issue Jun 22, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@nxj
Copy link

nxj commented Jun 22, 2022

Intellisense is not working correctly because an incorrect intellisense configuration is supplied:

IAR Build log:

[22.6.2022, 10:39:21][Debug] Activating extension
[22.6.2022, 10:39:26][Debug] Found 13 project(s) in the workspace
[22.6.2022, 10:39:27][Debug] Project: selected 'cm7_0' (index 9)
[22.6.2022, 10:39:27][Debug] Configuration: selected 'Debug' (index 1)
[22.6.2022, 10:39:27][Debug] Not loading project 'cm7_0' using thrift, no appropriate workbench selected...
[22.6.2022, 10:39:27][Debug] Loaded extended project 'undefined'
[22.6.2022, 10:39:28][Debug] Collected 2 toolchains
[22.6.2022, 10:39:28][Debug] Toolchain: selected 'Embedded Workbench 9.0 (Arm)' (index 0)
[22.6.2022, 10:39:28][Debug] Loading thrift workbench 'Embedded Workbench 9.0 (Arm)'...
[22.6.2022, 10:39:30][Debug] Generating intellisense config for 'cm7_0':'Debug'...
[22.6.2022, 10:39:30][Debug] 1 new toolchain(s) added
[22.6.2022, 10:39:32][Debug] Loaded thrift workbench 'Embedded Workbench 9.0 (Arm)'
[22.6.2022, 10:39:32][Debug] Loading project 'cm7_0' using thrift...
[22.6.2022, 10:39:32][Debug] Loading project context for 'cm7_0'
[22.6.2022, 10:39:35][Debug] Loaded extended project 'cm7_0'
[22.6.2022, 10:39:37][Debug] Intellisense config changed. Notifying cpptools.
[22.6.2022, 10:39:37][Debug] Providing intellisense configuration(s) for: c:\Projects\Project\main.c

IAR Config Generator:

Done!
Generating intellisense information for c:\Projects\Project\main.c

C/C++ extension log:

sending compilation args for C:\Projects\Project\main.c
    include: C:\PROJECTS\PROJECT\SRC
    ...(more includes)
    define: _DEBUG
    define: UNICODE
    define: _UNICODE
    stdver: ms_c17
    intelliSenseMode: windows-msvc-x64

It does work for files which are not in the current project (although it is the wrong configuration for these files):

IAR Build log:

[22.6.2022, 10:39:37][Debug] Using fallback intellisense configuration for: c:\Projects\Project\main2.c

C/C++ extension log:

sending compilation args for C:\Projects\Project\main2.c
    include: C:\PROJECTS\PROJECT\SRC
    ...(more includes)
    define: __fp16=float
    define: __CHAR_BITS__=8
    define: __CHAR_MAX__=0xff
    define: __CHAR_MIN__=0
    define: __CHAR_SIZE__=1
    define: __UNSIGNED_CHAR_MAX__=0xff
    define: __SIGNED_CHAR_MAX__=127
    ... (more defines)
    stdver: c17
    intelliSenseMode: windows-clang-arm

Any help would be appreciated!

@HampusAdolfsson HampusAdolfsson self-assigned this Jun 22, 2022
@HampusAdolfsson HampusAdolfsson added the bug Something isn't working label Jun 22, 2022
@HampusAdolfsson
Copy link
Collaborator

Do you see anything like this in the C/C++ extension logs? You might need to increase the logging level (C_Cpp.loggingLevel):

cpptools/queryTranslationUnitSource: C:\Projects\Project\main.c (id: 3)
Custom configurations received:
   uri: ...
   config: { ...

If so, does the uri and configuration look correct? The configuration you get for main.c is the default intellisense config, which means that the C/C++ extension either isn't receiving the custom configuration, or is ignoring it.

@nxj
Copy link
Author

nxj commented Jun 22, 2022

No, a custom configuration is not received:

loggingLevel: Debug
Custom configuration provider 'IAR Build' registered
Custom browse configuration received: {
  "browsePath": [ ... ],
  "compilerPath": "",
  "compilerArgs": [],
  "standard": "c17",
  "windowsSdkVersion": "",
  "compilerArgsLegacy": []
}
cpptools/didChangeCppProperties
Unable to configure for compiler cl.exe.
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
Code browsing service initialized
Unable to configure for compiler cl.exe.
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
  Folder: C:/PROJECTS/PROJECT/ will be indexed
cpptools/didChangeCustomBrowseConfiguration
Discovering files...
Skipping query of compiler due to explicitly empty compilerPath
  Folder: C:/PROJECTS/PROJECT/ will be indexed
  ... (more indexing)

cpptools/didChangeSettings
IntelliSense Engine = Default.
Enhanced Colorization is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Autocomplete is enabled.
cpptools/didChangeSettings
IntelliSense Engine = Default.
Enhanced Colorization is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Autocomplete is enabled.
cpptools/didChangeCppProperties
cpptools/pauseParsing
cpptools/clearCustomConfigurations
cpptools/queryTranslationUnitSource: C:\Projects\Project\main.c (id: 2)
textDocument/didOpen: C:\Projects\Project\main.c
cpptools/clearCustomConfigurations
Checking for syntax errors: C:\Projects\Project\main.c
cpptools/queryTranslationUnitSource: C:\Projects\Project\main.c (id: 3)
cpptools/resumeParsing
cpptools/resumeParsing
cpptools/getDocumentSymbols: C:\Projects\Project\main.c (id: 4)
cpptools/getCodeActions: C:\Projects\Project\main.c (id: 5)
cpptools/getFoldingRanges: C:\Projects\Project\main.c (id: 6)
Aborting tag parse of C:\Projects\Project\main.c and dependencies
  Discovering files: 0 file(s) processed
Done discovering files.
Discovering files...
  Processing folder (recursive): C:/PROJECTS/PROJECT/SRC
  ...(more processing)
  Discovering files: 9654 file(s) processed
  0 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  ...
sending compilation args for C:\Projects\Project\main.c
...

For the file which is not part of the project i do receive a custom configuration.

@HampusAdolfsson
Copy link
Collaborator

Just to clarify some things:
Do you get the incorrect configuration for all files in the project, if there are multiple?
Does this occur for all projects you open or just this one?

There is an unlikely case where an error could occur but not be logged, and that seems to be the only possible explanation here. To confirm it, I would need to add some more logging in the next extension update, and then you can check the logs again after the update is released. I'm not sure exactly when that will be, but it should be fairly soon.

@nxj
Copy link
Author

nxj commented Jun 27, 2022

Yes, i get the incorrect configuration for all files in the project and this also occurs for all projects.

@nxj
Copy link
Author

nxj commented Jun 28, 2022

Okay, so i dug a bit more into this. Seems like the C++ extension has a 2 second timeout on providing it the configuration and this extension needs more than this (~2-4s) on my machine / for my project. Any idea how to speed this up?

@HampusAdolfsson
Copy link
Collaborator

Thanks, that explains a lot. In order to generate the configuration for a file, we run the compiler with some special flags that output include paths and defines. This parses the entire file, so if the file is large or the cpu is busy, it's not impossible for this to take a few seconds.

I'll see if we can speed it up in any way, but I also want to ask the C/C++ extension developers if they could increase the timeout window; 2 seconds seems like a really short timeout.

@HampusAdolfsson
Copy link
Collaborator

Increasing the timeout has apparently been asked about before:
microsoft/vscode-cpptools#2229

I've fixed the problem by checking if we time out, and asking the C++ extension to resend the reqeust in that case.

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

2 participants