Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

rename of typedef'd struct doesn't work properly with unnamed structs

Abierto
#14,162 1 comentario 0 reacciones 0 asignados Ver en GitHub

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
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c
Área
tooling

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

bug Feature: Find All References Feature: Rename Language Service Works in VS
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.

Image

When giving it a name, i.e.

typedef struct foo_s {
    int a;
} type_t;

the rename goes through immediately.

Image

EDIT2: This also affects renaming the fields of the struct.

Steps to reproduce:

  1. Make file main.c with:
typedef struct {
    int a;
} type_t;

type_t x;

int main() {
  return 0;
}
  1. Rename Symbol type_t
  2. Depending on where you trigger the rename (typedef or variable definition) the other one is NOT A REFERENCE
  3. Give the type any name
  4. Rename Symbol
  5. 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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/vscode-cpptools

Todos los issues de microsoft/vscode-cpptools

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.