microsoft / microsoft/vscode-dotnettools

[Feature Suggestion]: Renaming a file should rename the containing class; renaming a folder should rename the namespace in all affected files

Open
#127 4 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-project area-project-cps enhancement triaged
Dominant language
No language data
Stars
321
Forks
54
Avg merge
2d 19h
Merged PRs (30d)
2

Description

Describe the feature you'd like

This is concerning the solution explorer view.

In Visual Studio, renaming any *.cs file can prompt the user, asking whether the contained class should also be renamed (as long as the names matched). The same thing happens with folders, which will prompt the user, asking whether the namespace should be renamed as well (given the namespaces matched the folder structure thus far). All files referencing this namespace will then be adjusted, including using directives in files not related to this hierarchy at all.

This feature would be nice to have in Visual Studio Code as well. Ideally, the prompts should go both ways: renaming a class or namespace should prompt the user, asking whether the file or folder should be renamed too.

Alternatives considered

No response

Environment Information
  • OS version: Windows_NT x64 10.0.22621
  • VS Code version: Code 1.79.0 (b380da4ef1ee00e224a15c1d4d9793e27c2b6302, 2023-06-07T14:26:35.552Z)
  • Extension version: 0.1.83

Contributor guide

No contributing guide indexed for this repository

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 with the solution explorer view and review how file and folder renames are currently handled in the C# Dev Kit. Define the prompt behavior for matching class and namespace names, including reverse renames and references in unrelated files. Done means the requested rename prompts and affected references work consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.