Skip to content

F12 “Go to Definition” no longer works inside comments (regression, even in older extension versions) #14173

@shaundawson789

Description

@shaundawson789

Environment

Environment

VS Code: latest stable

C/C++ extension: tested on latest + 1.17.5

OS: Windows

IntelliSense: working correctly (F12 works in real code)

Description

In previous versions of the C/C++ extension, F12 (Go to Definition) worked when the cursor was on a symbol inside a comment. This was extremely useful for navigating code while reading documentation or commented‑out lines.

In current versions, F12 does "No definition found" when the symbol is inside a comment, even though:

the symbol resolves correctly in real code

IntelliSense is functioning

the symbol is indexed

the comment does not contain syntax errors

the comment is not inside disabled preprocessor blocks

This behaviour persists even when downgrading the extension to 1.17.5, which previously supported this feature.

Reproduction

Create a function:

void display_string_address(void) {}

Add any of the following comments:

// display_string_address()
// display_string_address
// call display_string_address()
// NOTE: display_string_address

Place the cursor on display_string_address

Press F12

Expected

VS Code should jump to the function definition (as it did in earlier versions).

Actual

“No definition found for 'display_string_address'”

Notes

F12 works correctly when the symbol is in real code.

IntelliSense database is valid and up to date.

This appears to be a regression where comment text is no longer indexed for navigation.

There is no longer any setting to re‑enable this behaviour.

Request

Please confirm whether this is an intentional removal or a regression. If intentional, is there a supported way to restore F12 navigation from comments?

Bug Summary and Steps to Reproduce

as above

Configuration and Logs

{
    "configurations": [
        {
            "name": "windows-gcc-x64",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "compilerPath": "C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe",
            "cStandard": "${default}",
            "cppStandard": "${default}",
            "intelliSenseMode": "windows-msvc-x64",
            "compilerArgs": [
                ""
            ]
        }
    ],
    "version": 4
}

-------- Diagnostics - 2/7/2026, 7:10:01 PM
Version: 1.30.4
Current Configuration:
{
    "name": "windows-gcc-x64",
    "includePath": [
        "c:/Users/shaun/OneDrive/Documents/Gold+ test/Gold+.cydsn/**"
    ],
    "compilerPath": "C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerArgs": [
        ""
    ],
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathInCppPropertiesJson": "C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe",
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.customConfigurationVariables": {}
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.30.2.0
Current database path: C:\USERS\SHAUN\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\8D8EF55A38FB492EE7335FF66A5DCAC9\.BROWSE.VC.DB
No active translation units.

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

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions