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

Support LF linebreaks #9

Closed
fflaten opened this issue Aug 15, 2022 · 2 comments
Closed

Support LF linebreaks #9

fflaten opened this issue Aug 15, 2022 · 2 comments

Comments

@fflaten
Copy link

fflaten commented Aug 15, 2022

Only recognizes linebreak with CRLF atm.
Should support LF due to more common use with cross-platform scripts.

@mklement0
Copy link
Contributor

mklement0 commented Apr 5, 2024

@fflaten, as a stopgap, you can patch a current installation of the module as follows:

In ShowPSAst.psm1, as currently available via the gallery, replace:

            $text = [string]$InputObject
            if (Test-Path -LiteralPath $text)
            {
                $path = Resolve-Path $text
                $InputObject = [System.Management.Automation.Language.Parser]::ParseFile($path.ProviderPath, [ref]$null, [ref]$null)
            }
            else
            {
                $InputObject = [System.Management.Automation.Language.Parser]::ParseInput($text, [ref]$null, [ref]$null)
            }

with:

            $text = [string]$InputObject
            if (Test-Path -LiteralPath $text)
            {
                # To also support LF-only files, read the file in full and normalize the newlines to CRLF, 
                # which the WinForms textbox control requires for proper display.
                $text = (Get-Content -Raw -LiteralPath $text) -replace '(?<!\r)\n', "`r`n"
            }
            $InputObject = [System.Management.Automation.Language.Parser]::ParseInput($text, [ref]$null, [ref]$null)

Given the unknown status of this project (as you know), I'm not submitting a PR.

Generally, it would be nice if a cross-platform, console-based re-implementation were to become part of the Microsoft.PowerShell.ConsoleGuiTools tools (which currently provide Out-GridConsoleView and Show-ObjectTree) - see:

@lzybkr
Copy link
Owner

lzybkr commented May 7, 2024

@mklement0 - I just don't have much extra time these days.

I should probably just archive the project and hope that someone starts something that works better cross-platform, but I could also consider handing off maintaining this project if someone offered.

@lzybkr lzybkr closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants