Skip to content

"Switch Header/Source" doesn't find extensionless headers #618

Closed

Description

@IcedLance
  • cpptools Version: 0.10.5

Steps to Reproduce:

  1. Have a complicated folder structure with several classes of same name in different folders and different namespaces, but in files with the same name
  2. Automatic Alt+O "Switch between Source/Header" jumps to a wrong header.

Example:
https://github.com/openscenegraph/OpenSceneGraph/
Pressing Alt+O when at ./src/osg/Geode.cpp
jumps to ./src/osgPlugins/ac/Geode.h
instead of ./include/osg/Geode [no .h at the end]

Doesn't work at all when in ./include/osg/Geode

Activity

  1. sean-mcmanus commented on Apr 10, 2017

    @sean-mcmanus
    Contributor

    Header switching currently only works with a set of hard-coded header (and source) file extensions like .h, .hpp, .hh, and .hxx, so the extensionless "Geode" header will not work. We might be able to add this ability later, although even Visual Studio doesn't switch to extensionless headers. If you find another issue using headers with extensions, let us know.

  2. mjendruk commented on Oct 9, 2018

    @mjendruk

    I have similar issue. I have the following folder structure (simplified)

    componentA/tests/inc/TestDataBuilder.h
    componentA/tests/src/TestDataBuilder.cpp
    componentB/tests/inc/TestDataBuilder.h
    componentB/tests/src/TestDataBuilder.cpp
    

    When componentB/tests/inc/TestDataBuilder.h is opened and I press Alt+O, the editor jumps to componentA/tests/src/TestDataBuilder.cpp instead of the source file in componentB. When I press Alt+O a second time, it jumps to componentA/tests/inc/TestDataBuilder.h. It seems that the algorithm simply picks the first header it finds in alphabetical order without considering locality.

  3. da2r-20 commented on Oct 9, 2018

    @da2r-20

    I have the same issue as Max Jendruk (@mjendruk)

  4. sean-mcmanus commented on Oct 9, 2018

    @sean-mcmanus
    Contributor

    Max Jendruk (@mjendruk) Your repro is different from the original issue. I've filed a new issue for you at #2635 .

  5. changed the title [-]"Switch Header/Source" matches wrong header[/-] [+]"Switch Header/Source" doesn't find extensionless headers[/+] on Oct 17, 2019
  6. github-actions commented on Oct 17, 2020

    @github-actions

    This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions