Skip to content

New-EditorFile posts input to currently open editor #3192

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

Closed
msftrncs opened this issue Feb 19, 2021 · 2 comments · Fixed by PowerShell/PowerShellEditorServices#1997
Closed
Labels

Comments

@msftrncs
Copy link

msftrncs commented Feb 19, 2021

Issue Type: Bug

Have an editor open, with some content, and for ease, place cursor at begining of the document, with it visible.

Execute "contents" | New-EditorFile "somefile"

You will find "contents" pasted at the cursor in the currently opened document, but will be switched to a new editor with a blank document. (Note, if some text was selected in the current document, it will be replaced by the pasted text meant for the new document.)

Extension version: 2020.6.0
VS Code version: Code 1.53.2 (622cb03f7e070a9670c94bae1a45d78d7181fbd4, 2021-02-11T11:48:04.245Z)
OS version: Windows_NT x64 10.0.19042

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz (8 x 2794)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.91GB (8.81GB free)
Process Argv --crash-reporter-id b4df00f3-aa06-4238-a0b4-aaf53730304f
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry914:30256638
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt600cf:30251589

@ghost ghost added the Needs: Triage Maintainer attention needed! label Feb 19, 2021
@msftrncs
Copy link
Author

I thought I was running PowerShell Preview extension, but for some reason the preview extension was disabled ... switched to the preview extension, version 2020.9.0 and the issue occurs exactly the same.

@SydneyhSmith
Copy link
Collaborator

Thanks @msftrncs we are able to reproduce this issue.

@SydneyhSmith SydneyhSmith added Area-psEditor Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Feb 23, 2021
fflaten added a commit to fflaten/PowerShellEditorServices that referenced this issue Feb 20, 2023
The object returned from GetEditorContext() always points
to the original file in CurrentFile. We need to get an updated object
after opening or creating a file to insert text in the right editor.

Fix PowerShell/vscode-powershell#3192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants