You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other extensions you installed (and if the issue persists after disabling them): n/a
The project uses CMake and generates compile_commands.json, which is correctly set in c_cpp_properties.json as "compileCommands": "${workspaceFolder}/output/compile_commands.json". This file is parsed properly, as I see expected info in the "output" tab when I enable high logging level. So for example there is a file external/distortos/source/threads/ThisThread.cpp. When I open it the output log says:
This is exactly what is used by the compiler, so everything seems fine. Note that the main folder of the project (${workspaceFolder}, which would be /home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad) is NOT in the include path when compiling this source file. When I would like to add a #include in this file, say /home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad/external/distortos/include/distortos/ThisThread.hpp, which is available via /home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad/external/distortos/include, I start typing the path I would like to use, which is #include "distortos/ThisThread.hpp". The problem here is that vscode suggest only #include "external/distortos/include/distortos/ThisThread.hpp" (as if ${workspaceFolder} could be used). This is not the case, file with such include fails to compile:
In case a header file is available from multiple locations in the include path, I would expect the suggestion which is the shortest and/or the one which has identical beginning to what I type to be prioritized and displayed at the very beginning of the list. So if header.h is located in external/someLibrary/includes/someLibrary via include path set to external/someLibrary/includes then when I type #include "someLibrary/hea..." I would expect to see someLibrary/header.h as the first suggestion, instead of external/someLibrary/includes/someLibrary/header.h as it is now.
Type: LanguageService
Describe the bug
The project uses CMake and generates
compile_commands.json, which is correctly set inc_cpp_properties.jsonas"compileCommands": "${workspaceFolder}/output/compile_commands.json". This file is parsed properly, as I see expected info in the "output" tab when I enable high logging level. So for example there is a fileexternal/distortos/source/threads/ThisThread.cpp. When I open it the output log says:This is exactly what is used by the compiler, so everything seems fine. Note that the main folder of the project (
${workspaceFolder}, which would be/home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad) is NOT in the include path when compiling this source file. When I would like to add a#includein this file, say/home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad/external/distortos/include/distortos/ThisThread.hpp, which is available via/home/freddie/Elektronika/ARM/Projects/CWC-STM32F4-mono-graphic-keypad/external/distortos/include, I start typing the path I would like to use, which is#include "distortos/ThisThread.hpp". The problem here is that vscode suggest only#include "external/distortos/include/distortos/ThisThread.hpp"(as if${workspaceFolder}could be used). This is not the case, file with such include fails to compile:My
c_cpp_properties.json:Expected behavior
In case a header file is available from multiple locations in the include path, I would expect the suggestion which is the shortest and/or the one which has identical beginning to what I type to be prioritized and displayed at the very beginning of the list. So if
header.his located inexternal/someLibrary/includes/someLibraryvia include path set toexternal/someLibrary/includesthen when I type#include "someLibrary/hea..."I would expect to seesomeLibrary/header.has the first suggestion, instead ofexternal/someLibrary/includes/someLibrary/header.has it is now.Screenshots
after accepting: