Skip to content

'switch header/source' doesn't work for switching from CUDA .cu to .cuh file #13575

Closed

Description

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.99.3
  • C/C++ Extension Version: 1.25.3

Bug Summary and Steps to Reproduce

Bug Summary:

When I'm in a .cuh file, 'switch header/source' goes to the corresponding .cu file, but the vice versa isn't true - I can't go from the .cu to .cuh file.

I've recreated the problem with a simple project that looks like so:

demo/
├─ include/
│ ├─ main.cuh
│ └─ second.hpp
└─ src/
├─ main.cu
└─ second.cpp

It switches between 'second (cpp)' header/source fine, but not between main (cuda) header/source

I'm usually running my project on a dev container on a remote host, but I've recreated it locally with windows.

Steps to reproduce:

  1. Go to a cuda source .cu file
  2. Use 'switch header/source'
  3. Nothing happens

Expected behavior:

For it to switch between the CUDA source and header.

Configuration and Logs

-------- Diagnostics - 5/1/2025, 8:46:25 AM
Version: 1.25.3
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "path/to/demo/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.compilerPath": "C:\\MinGW\\bin\\gcc.exe"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "BaseDockerfile": "dockerfile"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": true,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.25.3.0
Current database path: C:\USERS\HUGOP\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\69AD98F1343FF6AB5994CDF2FD2FED87\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Users\hugop\Documents\demo\include\second.hpp - source TU]:
[ C:\Users\hugop\Documents\demo\src\main.cu - source TU]:
    C:\Users\hugop\Documents\demo\include\main.cuh
[ C:\Users\hugop\Documents\demo\src\second.cpp - source TU]:
Translation Unit Configurations:
[ C:\Users\hugop\Documents\demo\include\second.hpp ]
    Process ID: 23072
    Memory Usage: 58 MB
    Include paths:
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
[ C:\Users\hugop\Documents\demo\src\main.cu ]
    Process ID: 3808
    Memory Usage: 60 MB
    Include paths:
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
[ C:\Users\hugop\Documents\demo\src\second.cpp ]
    Process ID: 13936
    Memory Usage: 59 MB
    Include paths:
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 178 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 1
Number of files parsed: 1


### Other Extensions

_No response_

### Additional context

_No response_`

Activity

  1. Colengms commented on May 2, 2025

    @Colengms
    Contributor

    Hi Hugo Phibbs (@HugoPhibbs) . Thanks for reporting this. It looks like .cu was missing from the map of source file to header file associations. I have a fix that should make it into our next insiders release.

  2. moved this from Pull Request to Done in cpptoolson May 5, 2025
  3. locked and limited conversation to collaborators on Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions