Feature Request: Suggest [nodiscard] as a C++ Keyword
BluTree opened this issue · comments
Environment
- OS and Version: W11 23H2 (22631.3447)
- VS Code Version: 1.89
- C/C++ Extension Version: 1.20.5
Bug Summary and Steps to Reproduce
Bug Summary:
C++ attributes (nodiscard, fallthrough, ...) are not proposed for auto-completion and doesn't seem to be recognized as C++ keywords when typing. The extension tries to match some symbols with the same name (that is, the attribute itself in a macro from a system/library header) but not the keyword directly.
Steps to reproduce:
- Write some function with return value
- Begin to type
nodi
in the brackets - Notice the auto-completion trying to match symbols with the name nodi, but not the keyword nodiscard
Expected behavior:
The auto-completion should propose C++ attributes when typing
Configuration and Logs
-------- Diagnostics - 5/14/2024, 1:01:48 PM
Version: 1.20.5
Current Configuration:
{
"name": "Win32",
"includePath": [
"d:/Documents/C++ tests/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"cppStandard": "c++23",
"cStandard": "c17",
"intelliSenseMode": "windows-msvc-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"mergeConfigurations": false,
"compilerPath": "cl.exe",
"browse": {
"path": [
"d:/Documents/C++ tests/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.20.5.0
Translation Unit Mappings:
[ D:\Documents\C++ tests\main.cpp - source TU]:
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\include\vcruntime.h
Translation Unit Configurations:
[ D:\Documents\C++ tests\main.cpp ]:
Process ID: 39540
Memory Usage: 203 MB
Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe
Includes:
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\include
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\atlmfc\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: ms_c++latest
IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 203 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 21241
------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.
Using: C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt/float.h
Alternative: "D:/Documents/C++ tests/ffmpeg/compat/float"
Using: C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt/math.h
Alternative: "D:/Documents/C++ tests/ffmpeg/compat/aix"
Alternative: "D:/Documents/C++ tests/ffmpeg/compat/djgpp"
Using: C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt/time.h
Alternative: "D:/Documents/C++ tests/ffmpeg/libavutil"
Other Extensions
No response
Additional context
No response
Thank you for your issue! This would actually qualify as a feature request as this functionality is not currently supported in Visual Studio. Please use this GitHub issue to track progress once it has been picked up.