question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code formatting repeats part of the code

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

Well I certainly haven’t seen this before. Let me know if I should move this to the PSSA repo instead.

I find myself in a bizarre situation where formatting causes part of my code to be repeated. I think a GIF explains it the best: vscode-powershell-formatting-quirk (Title is cut off because of the height - I can’t share too much of the file 😕)

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.22524
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.63.2
899d46d82c4c95423fb7e10e68eba52050e30ba3
x64

Extension Version

ms-vscode.powershell@2021.10.2

Steps to Reproduce

I have no clue… and installs it is something I typed shortly before noticing this behavior, but I’m fairly certain I also typed other stuff later on.

The comment this is happening on is the first line of the file.

Visuals

See above 😃

Logs

After setting the log level to Debug and restarting PS, the issue stopped reproducing.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
50Wliucommented, Jan 18, 2022

Yeah, feel free to keep this one closed. I haven’t had the opportunity to use PowerShell since opening this issue. If it does happen again later down the road, I’ll let you know.

1reaction
50Wliucommented, Dec 30, 2021

That’s because it’s the holidays, msftbot 😦. I can install the preview extension, but since I can’t reliably reproduce it, I’m not sure how useful of a baseline that will be.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Formatting and Code Comments - A Beginner's Guide to ...
The basic tools for that are indentation, line breaks, and other formatting options. Here's how to use them in different programming languages.
Read more >
Repetition in programming | AP CSP (article) - Khan Academy
With a for loop, we can tell the computer to repeat an instruction so that we don't need to repeat it in code....
Read more >
Number format codes - Microsoft Support
To repeat a character in the number format so that the width of the number fills the column, precede the character with an...
Read more >
Repeating code using Loops - Know the Code
Repeat. Therefore, when using the while , the loop will continue looping (repeating the code within its code block) until the conditional ...
Read more >
Coding conventions (code style)
Code formatting and whitespace · open the Preferences > Java > Code Style > Formatter dialog · press Edit... · In the Indentation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found