VSCode GoToDefinition behaviour - can't just go to next nest

249 Views Asked by At

When you have to work with STM32 HAL you know, there is many macros and sometimes you want to know where is implemented this one. In my example, in line 40 i use F12 on label PROSTE_MAKRO (F12 is GoToDefinition). In my case this function directs me to line 30, where is defined macro SRC, not my PROSTE MAKRO what i expect. It looks like this VSCode function GotoDefinition think to much how to (NOT!) help me and evaluate my macro to basic forms. But half of code i have in HAL is macros and i expect gotoDefinition shoud redirect me by any (if is more than one) nested definition. I want it and this is how many IDE works.

I use Visual Studio Code with Plaftormio and C/C++ Microsoft extension. I have configure c_cpp_properties.json file with my configuration name, paths etc. I've made all toolchain from EmbeddedGeek yt video, but it all works good. (STM32F767 code generation and flashing is ok).

I have no idea wtf is wrong with VSCode but any day give me new reason to hate VSC.

I'm trying ask google about it but ofc i've reveive zero answer. I'm trying change goto behavior in general settings (13 setting found) but always it work wrong. I have record it on YT so you can watch it: https://www.youtube.com/watch?v=5FADq5yRp6g And now i think SO is my last option.

1

There are 1 best solutions below

0
On

In file: .vscode\c_cpp_properties.json in field: "intelliSenseMode": "windows-msvc-x86",
"compilerArgs": [],
"compilerPath": ""
I have defined my toolchain compiler and it's args. VScode automatic recognize it and think it is something different than default and change Intellisense mode to other (in my case it was arm-gcc or so). And it is. I have delete my compliler path and compiler args and leave it empty. Now GoToDefinition (default F12) work good.
But be careful - if you change "intelliSenseMode" to windows-msvc-x86 but set compiler path and args VSCode will inform you that intelliSenseMode is different than you try set. In any case - don't touch it.