PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Add some form of error/output if $Profile does not exist or create one when Extension is installed
When running the following command you get no results by default:
$psEditor.Workspace.OpenFile($profile)
$profile outputs this
PS C:\Program Files (x86)\Microsoft VS Code Insiders
$profile
C:\Users\i2871rbp\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1
However, the file does not actually exist, so when you try to have code open it, it does nothing and gives no feedback.
Can the EditorServices check for the profile and create it if it is missing upon installation? I am just thinking from an ease of use for normal powershell users who may not have a ton of Dev type experience, it might be a bad experience for them.
Damn, I thought that worked. Apparently it doesn't! I need to add an overload that allows you to create a new file if it doesn't already exist. Great feedback, keep it coming!
@daviwil I need to check into this one again. Have you added any additional handling for the profile in any of the newer versions? I am working on a blog post that covers the profile, but wasn't sure if the extension handles creating it yet or not.
I do think there needs to be some sort of way of informing users that the pses has it's own profile that can be configured.
I don't think the PSES profile should be created automatically and it is not really an error if a profile script doesn't exist. That said, a message dumped to the Debug Console about Processing Microsoft.VSCode_profile.ps1 - file not found, skipping might help advertise this feature is available.
@rkeithhill good point keith. I like that idea.
I do think more could be done for discoverability. A question I often get is where is the VSCode profile. I don't think many realize they would need to make it if they are actually looking for it.
Hmm, I just checked, and I actually do create the profile if it doesn't exist in this
https://github.com/PowerShell/PowerShellEditorServices/pull/254
So, maybe that will be enough for discoverability when that gets pulled in, though it may be beneficial to have a top level command to open the VSCode profile.
Just doing some issue clean up... based on the title, it sounds like #254 fixed the issue. The top level cmd to open the profile is a good idea though - we should have an issue open that tracks just that. Thoughts?