Skip to content

template semantic token highlighting incorrect in some circumstances #14491

Description

@msftrncs

Environment

Version: 1.122.0 (user setup)
Commit: 6a49527b96e326fe62fbdb56f60e16877c9aa724
Date: 2026-05-27T14:03:01-07:00
Electron: 39.8.8
ElectronBuildId: 13870025
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

C/C++ v1.32.2

Bug Summary and Steps to Reproduce

Bug Summary:

Semantic token highlighting can be weird in some circumstances of template declarations, in this example specifically a long friend declaration to a templated function where the template parameters are split over multiple lines, and there may be a VS CODE issue causing the semantic token highlighting to then be incorrectly rendered.

Steps to reproduce: (see sample)

class test {};

namespace fw {
template <typename Tv, typename Tx> Tv &GetTrackedActivePgnSignal(Tv &,
                                                                                             test &,
                                                                                             int);
}

class RotAngle_GoodValue_CommRx {};

class RotAngle_GoodValue_Comm {};

struct RotAngle_GoodValue_CommRx : RotAngle_GoodValue_Comm {

    friend RotAngle_GoodValue_CommRx &fw::GetTrackedActivePgnSignal<RotAngle_GoodValue_CommRx,
                                                                    RotAngle_GoodValue_Comm>(RotAngle_GoodValue_CommRx &,
                                                                                             test &,
                                                                                             int);
};
Image Image Image

Expected behavior:
The token RotAngle_GoodValue_CommRx (line 15, second occurrence) is expected to be tokenized (semantically) as a type, but instead it gets shown as a function name, and the last character (x) is shown as a variable, though the diagnostics seem to indicate that sematic token includes the last character as a type name. It would appear that there are two overlapping semantic tokens here.

Configuration and Logs

-------- Diagnostics - 5/28/2026, 7:09:38 PM
Version: 1.32.2
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Repositories/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPath": "",
    "compilerPathIsExplicit": true,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.autocompleteAddParentheses": true,
    "C_Cpp.default.compilerPath": ""
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.Ps1xml": "xml",
        "*.H86": "hex",
        "*.kwaconfig": "json",
        "*.tcc": "cpp",
        "*.xslt": "xsl",
        "*.rstc": "ini"
    },
    "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.32.2.0
Current database path: C:\Users\cmorris\AppData\Local\Microsoft\vscode-cpptools\49401b1062abc0fe200dfa533953fe2b\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Repositories\class test.cpp - source TU]:
Translation Unit Configurations:
[ C:\Repositories\class test.cpp ]
    Process ID: 89948
    Memory Usage: 30 MB
    Include Paths:
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 30 MB

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

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Type

Projects

Status
In progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions