rename of typedef'd struct doesn't work properly with unnamed structs
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza con la reproducción de main.c e inspecciona la entrada cpptools/rename que aparece en el registro de language-server. Compara los resultados del renombrado para estructuras typedef con nombre y sin nombre, incluidos los campos de las estructuras; se considera completado cuando todas las referencias relevantes de typedef, variables y campos se detectan de forma coherente sin seleccionar casillas manualmente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
- OS and Version: W10 22H2
- VS Code Version: 1.108.2
- C/C++ Extension Version: 1.30.3
- If using SSH remote, specify OS of remote machine: no
Bug Summary and Steps to Reproduce
Bug Summary:
If you don't name the struct in a typedef, i.e.
typedef struct {
int a;
} type_t;
renaming the type (here: type_t) does list all references * as NOT A REFERENCE and with the checkbox not ticked.
* EDIT: If you define multiple variables and you rename the type there, it does detect the other variables as references, but not the typedef itself. If renaming at the typedef, none of the variables are references.
When giving it a name, i.e.
typedef struct foo_s {
int a;
} type_t;
the rename goes through immediately.
EDIT2: This also affects renaming the fields of the struct.
Steps to reproduce:
- Make file main.c with:
typedef struct {
int a;
} type_t;
type_t x;
int main() {
return 0;
}
- Rename Symbol
type_t - Depending on where you trigger the rename (typedef or variable definition) the other one is NOT A REFERENCE
- Give the type any name
- Rename Symbol
- Now it magically is a reference ...
Expected behavior:
Rename works the same in both cases without saying it's NOT A REFERENCE when unnamed.
I mean, it isn't a huge problem, but having to tick the boxes each time because it doesn't detect that it's in fact a reference gets annoying.
But I'm happy that renaming macros finally works 😁
Configuration and Logs
This is basically the default configuration for gcc, but there you go:
[c_cpp_properties.json]
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "C:/Program Files/mingw64/bin/gcc.exe",
"cppStandard": "c++03",
"intelliSenseMode": "windows-gcc-x64",
"cStandard": "c99"
}
],
"version": 4
}
[C/C++: Log Diagnostics]
-------- Diagnostics - 2/3/2026, 11:00:26 AM
Version: 1.30.3
Current Configuration:
{
"name": "Win32",
"includePath": [
"d:/Syncbox/test/c-test/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "C:/Program Files/mingw64/bin/gcc.exe",
"cppStandard": "c++03",
"intelliSenseMode": "windows-gcc-x64",
"cStandard": "c99",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"recursiveIncludesReduceIsExplicit": false,
"recursiveIncludesPriorityIsExplicit": false,
"recursiveIncludesOrderIsExplicit": false,
"compilerPathInCppPropertiesJson": "C:/Program Files/mingw64/bin/gcc.exe",
"mergeConfigurations": false,
"recursiveIncludes": {},
"browse": {
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.inlayHints.parameterNames.enabled": true,
"C_Cpp.inlayHints.parameterNames.suppressWhenArgumentContainsName": false,
"C_Cpp.inlayHints.referenceOperator.enabled": true,
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.default.cStandard": "c99",
"C_Cpp.vcFormat.indent.caseLabels": true,
"C_Cpp.vcFormat.newLine.beforeCatch": false,
"C_Cpp.vcFormat.newLine.beforeElse": false,
"C_Cpp.commentContinuationPatterns": [
{
"begin": "/**",
"continue": "*"
}
],
"C_Cpp.experimentalFeatures": "enabled"
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {
"*.njs": "javascript",
"*.cps": "javascript",
"*.scr": "freebasic",
"*.FCMacro": "python"
},
"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\ANDREAS\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\4D947C8EF103797001BE961BE2B4AFE0\.BROWSE.VC.DB
Translation Unit Mappings:
[ D:\Syncbox\test\c-test\main.c - source TU]:
Translation Unit Configurations:
[ D:\Syncbox\test\c-test\main.c ]
Process ID: 11472
Memory Usage: 52 MB
Compiler Path: C:\Program Files\mingw64\bin\gcc.exe
Include paths:
system include: C:\Program Files\mingw64\lib\gcc\x86_64-w64-mingw32\15.1.0\include
system include: C:\Program Files\mingw64\include
system include: C:\Program Files\mingw64\lib\gcc\x86_64-w64-mingw32\15.1.0\include-fixed
system include: C:\Program Files\mingw64\x86_64-w64-mingw32\include
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: c99
IntelliSense Mode: windows-gcc-x64
Other Flags:
--gcc
--gnu_version=150100
Total Memory Usage: 52 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3232
[the language server logging]
LSP: (received) cpptools/rename: file:///d%3A/Syncbox/test/c-test/main.c (id: 503)
LSP: (invoked) cpptools/rename: file:///d%3A/Syncbox/test/c-test/main.c (id: 503)
LSP: (received) textDocument/documentHighlight: file:///d%3A/Syncbox/test/c-test/main.c (id: 504)
LSP: (invoked) textDocument/documentHighlight: file:///d%3A/Syncbox/test/c-test/main.c (id: 504)
LSP: Sending response (id: 504)
LSP: Sending response (id: 503)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didChange: file:///d%3A/Syncbox/test/c-test/main.c
LSP: (invoked) textDocument/didChange: file:///d%3A/Syncbox/test/c-test/main.c
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/Syncbox/test/c-test/main.c (id: 505)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/Syncbox/test/c-test/main.c (id: 505)
LSP: Sending response (id: 505)
LSP: (received) cpptools/getCodeActions: file:///d%3A/Syncbox/test/c-test/main.c (id: 506)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Syncbox/test/c-test/main.c (id: 506)
LSP: Sending response (id: 506)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Syncbox/test/c-test/main.c (id: 507)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Syncbox/test/c-test/main.c (id: 507)
tag parsing file: D:\Syncbox\test\c-test\main.c
LSP: Sending response (id: 507)
Intellisense update pending for: file:///d%3A/Syncbox/test/c-test/main.c
IntelliSense update scheduled and TU acquisition started for: file:///d%3A/Syncbox/test/c-test/main.c
Update IntelliSense time (sec): 0.012
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/Syncbox/test/c-test/main.c (id: 508)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/Syncbox/test/c-test/main.c (id: 508)
LSP: Sending response (id: 508)
Other Extensions
No response
Additional context
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 20 h 53 min
- PR fusionados (30 d)
- 41
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-cpptools
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
microsoft/vscode-cpptools#14817 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
microsoft/vscode-cpptools#14816 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
microsoft/vscode-cpptools#14815 ·
Los mantenedores suelen responder en 1 día
-
False C/C++(65) after rapid snippet replacement: identical source gets different diagnosticsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14807 ·
Los mantenedores suelen responder en 1 día
-
Intellisense errors for projects after updating C/C++ extension to a version newer than 1.32.2Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14806 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/vscode-cpptools
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día