vscode-powershell: Code formatting causes cursor to jump to EOF

I have my formatting style set to Allman. If I start typing something, e.g. a function, or a process block and put the open-brace at the end of the line, when the formatter kicks in and moves it to the next line, the cursor also jumps to the last line of the file. Here’s a screen grab of what happens. formatter

Disabling the add-in resolves the issue

System Details

  • Operating system name and version: Win 10 1709
  • VS Code version: 1.26.1 493869ee8e8a846b0855873886fc79d480d342de x64
  • PowerShell extension version: 1.8.3
  • Output from $PSVersionTable: Name Value

PSVersion 6.1.0-preview.1 PSEdition Core GitCommitId v6.1.0-preview.1 OS Microsoft Windows 10.0.16299 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Issue Description

I am experiencing a problem with…

Attached Logs

EditorServices.zip Follow the instructions in the [README](https://github.com/PowerShell/vscode-powershell#reporting-problems

) about capturing and sending logs.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (3 by maintainers)

Most upvoted comments

@TylerLeonhardt I’ve not noticed this issue since updating this morning, but then to be honest, I haven’t noticed the issue on the previous version for a while either. Happy to close if that’s the consensus.

Edit: hold fire, I did just experience something that looked like it when manually reformatting code. I’ll try to repro

Edit2: Yes, can repro if I’m making amendments as the formatter is still running. I’m not jumping to EOF, but getting duplicated code at the end of the module: cursorjump

Nope. My theory seems to be a bust. I found a 1690 line script that has no class definitions, but triggers this behaviour nonetheless.