Skip to content

Reindent problem with C# #168

Closed
Closed
@stephen147

Description

@stephen147

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions