dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 675 forks source link

Code actions renaming files not deleting old files #3616

Closed webczat closed 6 days ago

webczat commented 4 years ago

Issue Description

It seems like refactorings that rename files don't delete old files correctly.

Steps to Reproduce

Note that I didn't test it this way, it happened on a real project instead, so names are different.

Expected Behavior

The file should be renamed to X.cs, only X.cs should be open.

Actual Behavior

What seems to happen is that the old file is still open and still exists in workspace, and the new file is opened in modified/unsaved state. That way I have duplicate definition of class X in this hypothetical case.

Logs

OmniSharp log

Starting OmniSharp server at 2/29/2020, 12:25:10 AM Target: /home/webczat/apiview/apiview.sln OmniSharp server started. Path: /home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/run PID: 18358 [info]: OmniSharp.Stdio.Host Starting OmniSharp on arch 0.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.4 - "/home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to '/home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin/MSBuild.dll' [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.4 - "/home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin" CscToolExe = csc.exe MSBuildToolsPath = /home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin CscToolPath = /home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin/Roslyn BypassFrameworkInstallChecks = true MSBuildExtensionsPath = /home/webczat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/home/webczat/apiview'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem Detecting projects in '/home/webczat/apiview/apiview.sln'. [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/webczat/apiview/Lib/Lib.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/webczat/apiview/LibTests/LibTests.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/home/webczat/apiview'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/webczat/apiview/Lib/Lib.csproj [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200 [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/home/webczat/apiview' on host 18080. [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/home/webczat/apiview/Lib/Lib.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/home/webczat/apiview/Lib/Lib.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/webczat/apiview/LibTests/LibTests.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/home/webczat/apiview/LibTests/LibTests.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/home/webczat/apiview/LibTests/LibTests.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: Lib [info]: OmniSharp.MSBuild.ProjectManager Update project: LibTests [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers Solution initialized -> queue all documents for code analysis. Initial document count: 10. [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.ReAnalyzeService Queue analysis for project(s) (ProjectId, #ff0a19e8-8454-422f-a173-e22e7a7153b3 - ) [info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: Rename file to match first type name [info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService Applying code action: Rename file to match first type name [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.ReAnalyzeService Queue analysis for project(s) (ProjectId, #43dd4bad-50eb-4e0a-8ed7-85da7ff46748 - ) [info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.ReAnalyzeService Queue analysis for all projects.

Environment information

VSCode version: 1.43.0-insider C# Extension: 1.21.12

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.101 Commit: b377529961 Runtime Environment: OS Name: arch OS Version: OS Platform: Linux RID: linux-x64 Base Path: /opt/dotnet/sdk/3.1.101/ Host (useful for support): Version: 3.1.1 Commit: a1388f194c .NET Core SDKs installed: 3.1.101 [/opt/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.1 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.1 [/opt/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |cpptools|ms-vscode|0.26.3| |csharp|ms-vscode|1.21.12| |dotnet-test-explorer|formulahendry|0.7.1| |EditorConfig|EditorConfig|0.14.4| |github-actions-vscode|OmarTawfik|2.7.0| |gitlens|eamodio|10.2.1| |markdown-preview-enhanced|shd101wyy|0.5.2| |msbuild-project-tools|tintoy|0.3.3| |vscode-pull-request-github|GitHub|0.14.0| |vscode-yaml|redhat|0.7.2| |xml|DotJoshJohnson|2.5.0|;
JoeRobich commented 6 days ago

Closing due to little activity.