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

it goes to declaration instead of definition #3378

Closed
Lennon925 opened this issue Mar 29, 2019 · 5 comments
Closed

it goes to declaration instead of definition #3378

Lennon925 opened this issue Mar 29, 2019 · 5 comments
Labels
bug Feature: Go to Definition An issue related to Go to Definition/Declaration. fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@Lennon925
Copy link

Type: LanguageService

Describe the bug

  • OS and Version:
  • VS Code Version: 1.31.1
  • C/C++ Extension Version: 0.21
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce

  1. I add two folders to a new workspace, one folder is "cpps" and another one is "headers"
  2. In "apps" folder there is a cpp file called "cpp_test.cpp" and in "headers" folder there are two files, "header_test.h" and "header_test.cpp".
  3. code as following:

cpp_test.cpp(in cpps folder)
#include "../headers/headers_test.h"
int cpps_test()
{
ClassA *obj = new ClassA();
obj->test(); //"go to definition" on function "test" will go to declaration instead of def.
}

headers_test.h(in headers folder)
class ClassA {
public:
ClassA(){}
int test();
};

"headers_test.cpp(in headers folder)
#include "test.h"
ClassA::test(){
int mm = 0;
}

This is a bug? Are there some ways to resolve this issue?

@Lennon925
Copy link
Author

Then I removed "headers" folder from my workspaces. "go to definition" on function "Test" is right. But after I close and reopen vscode, it didn't work again.

@Lennon925
Copy link
Author

Lennon925 commented Mar 29, 2019

Then I removed "headers" folder from my workspaces. "go to definition" on function "Test" is right. But after I close and reopen vscode, it didn't work again.

I tried operators above for some times and it seems that it's not stabled. Sometimes it went to declarations and sometimes it went to declarations.

@sean-mcmanus sean-mcmanus added bug Language Service investigate: repro This issue's repro steps needs to be investigated/confirmed labels Mar 29, 2019
@sean-mcmanus sean-mcmanus self-assigned this Mar 29, 2019
@sean-mcmanus sean-mcmanus added this to the April 2019 milestone Mar 29, 2019
@sean-mcmanus sean-mcmanus added the Feature: Go to Definition An issue related to Go to Definition/Declaration. label Apr 17, 2019
@sean-mcmanus sean-mcmanus modified the milestones: April 2019, June 2019 May 8, 2019
@sean-mcmanus
Copy link
Contributor

Should be fixed 0.23.1.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 20, 2019
@sean-mcmanus sean-mcmanus modified the milestones: June 2019, April 2019 May 20, 2019
@sean-mcmanus sean-mcmanus removed their assignment May 20, 2019
@sean-mcmanus sean-mcmanus removed the investigate: repro This issue's repro steps needs to be investigated/confirmed label May 20, 2019
@aneox
Copy link

aneox commented Oct 4, 2020

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
}

@aneox
Copy link

aneox commented Oct 5, 2020

@sean-mcmanus please reopen

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Go to Definition An issue related to Go to Definition/Declaration. fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants