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

Browse.path not sent (Go to definition sometimes goes to the declaration instead) #1476

Closed
sean-mcmanus opened this issue Oct 5, 2020 · 19 comments

Comments

@sean-mcmanus
Copy link
Contributor

I am working in VSCode Version: 1.49.3 and have this bug, macOS 10.15.4

When I click "Go to definition", sometimes it went to declarations and sometimes it went to the definition.
No error or warning messages.

c_cpp_properties.json

{
  "configurations": [
    {
      "name": "vscode_stm32_c_cpp_properties",
      "compilerPath": "/Users/AneoX/compilers/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc",
      "includePath": [
        "${workspaceRoot}/Inc/",
        "${workspaceRoot}/Drivers/cmsis/",
        "${workspaceRoot}/Drivers/STM32F0xx_StdPeriph_Driver/inc/"
        // "${workspaceRoot}/**"
      ],
      "browse": {
        "path": ["${workspaceFolder}"],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db"
      },
      "cStandard": "c11",
      "cppStandard": "c++17",
      "intelliSenseMode": "gcc-arm",
      "configurationProvider": "ms-vscode.cmake-tools",
      "defines": ["USE_STDPERIPH_DRIVER", "STM32F042"]
    }
  ],
  "version": 4
}

Originally posted by @aneox in microsoft/vscode-cpptools#3378 (comment)

@sean-mcmanus
Copy link
Contributor Author

Go to definition going to the declaration instead of the definition is a symptom, which could have multiple root causes. Are you able to provide an isolated repro example? It's possible the IntelliSense type checking is failing when comparing the definition and the source identifier.

@aneox
Copy link

aneox commented Oct 6, 2020

@sean-mcmanus please take a look,
https://github.com/aneox/vscode_stm32f042_template
https://youtu.be/lFwKBK_vSsA
In video you can see, if I click "goto definitions", it went to the declaration.
But if I manually find src file, opened and closed it, then "goto to definition" become workable.

@sean-mcmanus
Copy link
Contributor Author

I'm not reproing the issue. Can you do a C/C++: Reset IntelliSense Database command and look for stm32f0xx_rcc.c in the C/C++ logging (with C_Cpp.loggingLevel set to Debug)? It looks like something is causing that file to not be parsed on your system.

You should see something like

------- Workspace parsing diagnostics -------
Number of folders and files enumerated: 506
Number of files discovered (not excluded): 251
Number of files parsed: 99

@aneox
Copy link

aneox commented Oct 6, 2020

I do not find where to see this stat

------- Workspace parsing diagnostics -------
Number of folders and files enumerated: 506
Number of files discovered (not excluded): 251
Number of files parsed: 99

But I made Reset IntelliSense Database and set debug level, no error messages and the same bug occur

some error find in Log (Extension Host)
[exthost] [error] [ms-vscode.cpptools] provider FAILED

@sean-mcmanus
Copy link
Contributor Author

The stats are from running C/C++: Log Diagnostics.

Did you see stm32f0xx_rcc.c in the "C/C++" logs? It should say "Tag parsing: ...stm32f0xx_rcc.c".

@aneox
Copy link

aneox commented Oct 6, 2020

The stats are from running C/C++: Log Diagnostics.

no info in C/C++: Log Diagnostics, only configuration print

Did you see stm32f0xx_rcc.c in the "C/C++" logs? It should say "Tag parsing: ...stm32f0xx_rcc.c".

in this log i see info only about the opened file, no info about parsing. How i should activate workspace parsing?

@aneox
Copy link

aneox commented Oct 6, 2020

C/C++ log print after reset, searching for files..., files - 0

@sean-mcmanus
Copy link
Contributor Author

What version of the C/C++ extension are you using?

@aneox
Copy link

aneox commented Oct 6, 2020

v1.0.1
when I hit save in the config file, then I see some output in С/С++ about parsing, it try to parse only *.h files

@aneox
Copy link

aneox commented Oct 6, 2020

I'm not reproing the issue. Can you do a C/C++: Reset IntelliSense Database command and look for stm32f0xx_rcc.c...

Actually bug occurs not only with stm32f0xx_rcc.c, with all source files.

@aneox
Copy link

aneox commented Oct 6, 2020

@sean-mcmanus I have installed VScode on Windows in the virtual machine on my Mac, "GoTo definition" works perfectly.

But in Mac version, do not work, so boring.
I want to switch my workspace from QT Creator ide to Code, but this bug so boring, please help.

@aneox
Copy link

aneox commented Oct 6, 2020

@sean-mcmanus ok, looks like I find a reason, after removing the git folder, bug gone
cd workspace && rm -rf .git
how I can exclude .git folder from parsing?

@aneox
Copy link

aneox commented Oct 6, 2020

I have added exclude git in settings.json with db reset

  "files.exclude": {
    "**/.git": true,
    "**/build": true
  },
  "search.exclude": {
    "**/.git": true,
    "**/build": true
  }

the same bug

@sean-mcmanus sean-mcmanus self-assigned this Oct 6, 2020
@sean-mcmanus
Copy link
Contributor Author

I wasn't able to repro this on Mac either. @Colengms @michelleangela Can either of you repro it?

It sounds like it could be an issue with "configurationProvider": "ms-vscode.cmake-tools" being set. That can override the browse.path setting. You might want to try removing that or looking to see if the logging indicates it's sending an invalid value for that.

@sean-mcmanus sean-mcmanus removed their assignment Oct 7, 2020
@aneox
Copy link

aneox commented Oct 7, 2020

@sean-mcmanus yes, after i removed "configurationProvider": "ms-vscode.cmake-tools", bug gone, works great

this line has been added with copy-paste from some tutorial.
Thank you!

@aneox
Copy link

aneox commented Oct 7, 2020

@sean-mcmanus maybe I do not need to remove this line, but find a fix in CMake config?

@sean-mcmanus
Copy link
Contributor Author

@aneox Yeah, for some reason the CMake Tools extension is not sending the correct browse info. I'm moving this issue to that extension.

@sean-mcmanus sean-mcmanus transferred this issue from microsoft/vscode-cpptools Oct 8, 2020
@sean-mcmanus sean-mcmanus changed the title Go to definition sometimes goes to the declaration instead Browse.path not sent (Go to definition sometimes goes to the declaration instead) Oct 8, 2020
@aleun aleun added the embedded label Dec 10, 2020
@rodrigobrochado
Copy link

Any progress on this. It seems that the extension is overiding the browse.path with an empty list.

@bobbrow
Copy link
Member

bobbrow commented Mar 10, 2022

This should have been fixed with #2418. The fix is now available in the "pre-release" version of CMake Tools. It will be included in 1.10. If you would like to try it out and see, please install the pre-release version.

@bobbrow bobbrow closed this as completed Mar 10, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants