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

Reindent problem with C# #168

Open
stephen147 opened this issue May 13, 2021 · 2 comments
Open

Reindent problem with C# #168

stephen147 opened this issue May 13, 2021 · 2 comments
Labels

Comments

@stephen147
Copy link

stephen147 commented May 13, 2021

I assume that this controls the indentation for .ps1 files so hopefully, this is the correct place to post this issue.

With Powershell I have this code:

Function Get-ForegroundWindow {
  Add-Type @"
  using System; using System.Runtime.InteropServices; public class ClassGetForegroundWindow {
    [DllImport("user32.dll")]
    public static extern IntPtr GetForegroundWindow();
  }
"@
  return [ClassGetForegroundWindow]::GetForegroundWindow()
}

Get-ForegroundWindow

After reindenting it it appears to be:

Function Get-ForegroundWindow {
  Add-Type @"
  using System; using System.Runtime.InteropServices; public class ClassGetForegroundWindow {
    [DllImport("user32.dll")]
    public static extern IntPtr GetForegroundWindow();
  }
  "@
  return [ClassGetForegroundWindow]::GetForegroundWindow()
}

Get-ForegroundWindow

This then fails to run as the "@ is indented when it shouldn't.

@keith-hall
Copy link
Member

I guess this repo lacks any tmPreferences files controlling indentation, so it uses the defaults. You'd want a unindentedLinePattern matching "@ iirc.

@stephen147
Copy link
Author

Oh, I didn't even think to see if there was one. I assumed there was.

Hopefully, this could get added as a rule if the person maintaining this repo sees this as it would be nice to be included out of the box.

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

No branches or pull requests

2 participants