Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove Unnecessary Usings is modifying white space before first type declaration #65114

Closed
drewnoakes opened this issue Oct 31, 2022 · 2 comments · Fixed by #76038
Closed

Remove Unnecessary Usings is modifying white space before first type declaration #65114

drewnoakes opened this issue Oct 31, 2022 · 2 comments · Fixed by #76038
Assignees
Labels
Milestone

Comments

@drewnoakes
Copy link
Member

drewnoakes commented Oct 31, 2022

Version Used: Version 17.5.0 Preview 1.0 [33027.274.main]

Steps to Reproduce:

  1. Create a file with unnecessary usings, with spaces before the first type declaration
  2. Create a .editorconfig specifying tabs
    [*.cs]
    indent_style = tab
    indent_size = tab
    tab_size = 4
  3. Invoke "Remove Unnecessary Usings"

Expected Behavior:

Only the usings are removed.

Actual Behavior:

Usings are removed, but trivia is also updated.

--- a/src/D2DLibExport/D2DGeometry.cs
+++ b/src/D2DLibExport/D2DGeometry.cs
@@ -22,22 +22,9 @@
  * SOFTWARE.
  */
 
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
-
-using FLOAT = System.Single;
-using UINT = System.UInt32;
-using UINT32 = System.UInt32;
-using HWND = System.IntPtr;
-using HANDLE = System.IntPtr;
-using HRESULT = System.Int64;
-using BOOL = System.Int32;
-
 namespace unvell.D2DLib
 {
-  public class D2DGeometry : D2DObject
+	public class D2DGeometry : D2DObject
   {
     internal HANDLE DeviceHandle { get; private set; }
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 31, 2022
@jasonmalinowski jasonmalinowski removed the untriaged Issues and PRs which have not yet been triaged by a lead label Nov 4, 2022
@jasonmalinowski jasonmalinowski added this to the Backlog milestone Nov 4, 2022
@jasonmalinowski
Copy link
Member

@drewnoakes: the .editorconfig is set to tabs, but the underlying file is still using spaces? I agree it's not ideal that we're touching that (and a bit odd we're not touching anything else...) but at the same time we more or less assume your .editorconfig is the source of truth.

@CyrusNajmabadi
Copy link
Member

It's expected that we do some touching of things (since we often have to clean up after ourselves). However, in this case, as there are no usings in the interior namespace, we absolutely should not be touching anything there.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants