Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Initial work to support bulk renaming of files to match types contained within. #77239

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 15, 2025
CyrusNajmabadi added a commit that referenced this pull request Feb 15, 2025
…ider. (#77244)

Extracted out all the cleanup and simplification i did in
#77239

This allows changing 'rename type to file' (and vice versa) to operate
entirely syntactically. This is important for fix all performance.
…nableNullableCodeRefactoringProvider.FixAllProvider.cs
@@ -1263,12 +1262,29 @@ protected override void ApplyDocumentInfoChanged(DocumentId documentId, Document
// By setting this property, Visual Studio will perform the file rename, which
// will cause the workspace's current solution to update and will fire the
// necessary workspace changed events.
projectItemForDocument.Name = uniqueName;
try
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonmalinowski i'm not sure what to do about these. trying to run this on Roslyn and i def ran into cases where tehse threw. i think it's all the linked files and shared-code-projects.

Unfortunately, on the feature-side, i'm not sure if there's any way to detect these cases up front and figure out how to avoid them. Any thoughts from you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CyrusNajmabadi Do you remember more what the failure was? I could imagine we may have an issue if your refactoring is trying to rename the same file more than once (but it's in different projects), and maybe that's what could be happening. But I have a vague memory of @ryzngard fixing some things there. But that's making a very random guess.

I don't even know if a feature could do filtering for other reasons like shared code projects, since we don't expose that in any way in the workspace layer. And frankly, we'd have to go figure out how to even know those ourselves since that's abstracted away from us too without calling a bunch of legacy VS APIs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr: let's figure out why it failed, since maybe that's something this layer can deal with. If it can't, then I don't imagine we can push it elsewhere, so maybe just catching the exception would be the right thing to do. It's probably better to apply most of the renames instead of crashing.

}
catch (KeyNotFoundException ex)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wasn't sure if i should move this into TryGetFullPatah (as that's an extension method we own). this feels like something messed up in the project system that we need this.

Note: i can provide you with file paths this happens for if that would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants