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

Handle UNC paths #6

Open
DTW-DanWard opened this issue Jun 13, 2017 · 6 comments
Open

Handle UNC paths #6

DTW-DanWard opened this issue Jun 13, 2017 · 6 comments

Comments

@DTW-DanWard
Copy link
Owner

See original issue record on blog; not sure of exact issue.

@DTW-DanWard
Copy link
Owner Author

@justusiv
Copy link

justusiv commented Sep 13, 2017

I have worked around this issue by wrapping it in a function that moves it local then runs Edit-DTWBeautifyScript

I am also using this function found here
https://stackoverflow.com/questions/8789870/powershell-ise-doesnt-refresh-modification-done-outside

function Reload {
$CurrentFile = $psise.CurrentFile
$FilePath = $CurrentFile.FullPath
$lineNum = $psise.CurrentFile.Editor.CaretLine
$colNum = $psise.CurrentFile.Editor.CaretColumn
$PsISE.CurrentPowerShellTab.Files.remove($CurrentFile) > $null
$newFile = $PsISE.CurrentPowerShellTab.Files.add($FilePath)
$newfile.Editor.SetCaretPosition($lineNum,$colNum)
}
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Reload File",{Reload},'f4') > $null

@DTW-DanWard
Copy link
Owner Author

DTW-DanWard commented Sep 15, 2017

Hey @justusiv Sorry I haven't looked into this one yet; I've been crazy busy. Hoping things quiet down for me in a few weeks and I'll have time to work on this.

In the meantime, have you tried VS Code with the PowerShell extension yet? I used to use ISE with ISESteroids (a great plug-in) but after trying VS Code I'm hooked. You do have to spend a some time learning how it works; basic editing and such is obvious but there are many hidden gems that you have to search for - my favorite is Show References Shift-F12. It's worth reading a few blogs about editing & debugging PowerShell in VS Code, you will definitely learn some new tricks. Also, VS Code gets a new release once a month or so - so it's constantly being updated with new functionality. There is one giant drawback; code folding doesn't currently work for regions, etc. They are working on this (see project Microsoft/vscode issues 3422) so perhaps the next release or two will fix it.

@justusiv
Copy link

@DTW-DanWard
Thanks for the reply. I will check it out when i get some time. I just tried ISESteroids this week and while i really liked it i ran into a few show stopping issues that i didnt want to troubleshoot. One example was code speed.
As far as Beautifier goes i have it working exactly the way i want even with UNC paths. The function above i modified to move the file local run your code then move it back to where it was before. I popped that into my profile and away i go.
I would be happy to post it but am not at the computer i set it up at.

@DTW-DanWard
Copy link
Owner Author

@justusiv No problem. When I get time I can look into it; copying to local temp is straight-forward but I also want to check out the System.IO library a little more closely to make sure there isn't anything I'm missing that I could be doing.

@justusiv
Copy link

@DTW-DanWard Absolutely. Its a work-around for sure but i am happy with it :)
Thanks for your contributions :)

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

No branches or pull requests

2 participants