microsoft / microsoft/vscode-cpptools

rename function name doesn't work in C project

Open
#12,238 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Rename Language Service not reproing
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows_NT x64 10.0.18362
  • VS Code Version: Code 1.88.1
  • C/C++ Extension Version: 1.20.1
  • If using SSH remote, specify OS of remote machine: none
Bug Summary and Steps to Reproduce

Bug Summary:

In a c project, when I try to rename function name or variables, i got :
A definition for the selected symbol could not be located.

even the function is only defined and used in merely one file.

I do the "rescan", disable and enable the cpptools and restart VSCode, none works.

Steps to reproduce:

  1. rename a function
  2. gives me "A definition for the selected symbol could not be located."

Expected behavior:
renaming should success

Configuration and Logs
c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\Program Files\\LLVM\\bin\\clang.exe",
            "cStandard": "c17",
            "cppStandard": "c++14",
            "intelliSenseMode": "windows-clang-x64"
        }
    ],
    "version": 4
}
Other Extensions

Extension | Author (truncated) | Version
doxdocgen | csc | 1.4.0
cpptools | ms- | 1.20.1
vscode-typings | typ | 0.0.5
clang-format | xav | 1.9.0

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the rename failure using the reported one-file C project and the provided c_cpp_properties.json configuration. Trace the C/C++ extension's rename flow from the selected symbol and compare it with definition lookup; done means function and variable renaming succeeds under the reported Windows and Clang configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, typescript, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.