microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.54k stars 1.56k forks source link

"Go to Definition" includes too many files from wrong folders #3253

Closed noppej closed 5 years ago

noppej commented 5 years ago

Type: LanguageService

Describe the bug

To Reproduce

  1. Open main.c
  2. Scroll to #include "main.h", and select the main.h text with the mouse
  3. Right-Click on 'Go To Defintion'
  4. See problem in screenshot

Expected behavior Only select main.h file that lives in folders referenced by include/browse path config

Screenshots

screen shot 2019-03-05 at 11 04 43 am

Additional context

settings for plugin that I think are relevant screen shot 2019-03-05 at 11 12 58 am

My c_cpp_properties.json

{
    "env": {
        "____________________USER_FIELDS_CAN_BE_MODIFIED____________________": "",
        "user_cSources": [
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_ts.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/ft5336/ft5336.c",
            "Src/STemwin_wrapper.c",
            "Src/HW_Init.c",
            "Src/GUIConf.c",
            "/Users/Jack/SSTP/Motor/Src/sstpCommon.c",
            "Src/emConsoleGUI.c"
        ],
        "user_asmSources": [],
        "user_cIncludes": [
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/STM32746G-Discovery/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/ft5336/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/BSP/Components/Common/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/ST/STemWin/inc/*"
        ],
        "user_asmIncludes": [],
        "user_cDefines": [
            "AVOID_EMPTY_DEFINE_FIELD_C",
            "__weak=\"__attribute__((weak))\"",
            "__packed=\"__attribute__((__packed__))\"",
            "USE_STM32F746G_DISCO"
        ],
        "user_asmDefines": [
            "AVOID_EMPTY_DEFINE_FIELD_ASM"
        ],
        "user_cFlags": [
            "-fmessage-length=0 -Wall -Werror-implicit-function-declaration -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast"
        ],
        "user_asmFlags": [],
        "____________________DO_NOT_MODIFY_FIELDS_BELOW____________________": "",
        "cubemx_sourceFiles": [
            "Src/main.c",
            "Src/freertos.c",
            "Src/stm32f7xx_it.c",
            "Src/stm32f7xx_hal_msp.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_crc.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_crc_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma2d.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_fmc.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sdram.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_iwdg.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_ltdc.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_ltdc_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dsi.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c",
            "Src/system_stm32f7xx.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/croutine.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/list.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/queue.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/tasks.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/timers.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/port.c",
            "startup_stm32f746xx.s"
        ],
        "cubemx_includes": [
            "/Users/Jack/SSTP/Console/Inc/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/include/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Device/ST/STM32F7xx/Include/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include/*",
            "/Users/Jack/SSTP/STM32Cube/STM32Cube_FW_F7_V1.15.0/Drivers/CMSIS/Include/*"
        ],
        "cubemx_defines": [
            "USE_HAL_DRIVER",
            "STM32F746xx"
        ],
        "gccExePath": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.2.1/.content/bin/arm-none-eabi-gcc",
        "gccIncludePath": "/Users/Jack/Library/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.2.1/.content/lib/gcc/arm-none-eabi/8.2.1/include"
    },
    "configurations": [
        {
            "name": "Console",
            "intelliSenseMode": "clang-x64",
            "includePath": [
                "${cubemx_includes}",
                "${user_cIncludes}",
                "${user_asmIncludes}"
            ],
            "browse": {
                "path": [
                    "${cubemx_includes}",
                    "${user_cIncludes}",
                    "${user_asmIncludes}"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "defines": [
                "${cubemx_defines}",
                "${user_cDefines}",
                "${user_asmDefines}"
            ],
            "forcedInclude": [],
            "compilerPath": "${gccExePath}",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}
sean-mcmanus commented 5 years ago

This is being track by https://github.com/Microsoft/vscode-cpptools/issues/2564 . Go to Def support for #include lines hasn't been switched to use the IntelliSense includePath yet.

sean-mcmanus commented 4 years ago

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.28.0-insiders .