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.

Extra space added after pasting JSDoc comment

See original GitHub issue
  • VS Code Version: 1.55.1 (but also 1.55.0 and at least the last one or two minor versions of v1.54)
  • OS Version: Windows 10

Code formatting in at least es6 is broken since last 2 or 3 minor versions of Vs Code. It happens a lot since that code aligns completely wrong and out of place while there is nothing wrong with the code. It’s pretty frustrating. This was working fine and without issues before. This is not an issue with some extension as it’s also the case when running without extensions.

The reason for this ‘confused formatter’ seems to be that after copying code with jsdoc, the alignment of the method name is wrong in the pasted fragment and that confuses the formatter for the rest of the code and every time it tries to format it after that paste. BTW in the example below the error-offset is only one space, but it also happens that the alignment skips ‘tabs’ (spaces here) and that makes the code even more misaligned and so unreadable and messed up.

See gif:

Formatter-Issue

Steps to Reproduce:

  1. Copy code with jsdoc
  2. Paste code with jsdoc
  3. See that the method name isn’t alligned as supposed to, but now is aligned to the jsDoc. See that the formatter is confused and keeps messing up.

Does this issue occur when all extensions are disabled?: Yes (see demo)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
SomervilleTomcommented, Oct 28, 2022

@bencresty: I’ve been on the developer’s side of a big project like this, and I’m therefore sympathetic.

I mostly hope that the visibility of this bug can be raised enough to get it onto the list of things to fix – perhaps even in the November update cycle.

I note that @ssigwart created a PR nearly a year ago that apparently fixes this annoying bug.

@mjbvz: Is there something I or we can do to allow the pending PR from @ssigwart to be approved? A brief description of the obstacle might allow us to help resolve it.

2reactions
ssigwartcommented, Apr 15, 2022

@bencresty, I’m just a contributor with limited repo permissions. I have the same feelings. I have several unreviewed pull requests that I can’t get any traction on. At this point, I’ve stopped contributing because I was just wasting my time. When someone starts responding to my PRs, I’ll start contributing again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use JSDoc: @param
Be sure to include a space before and after the hyphen. ... have a specific property, you can document that property by providing...
Read more >
jsdoc: multiline description @property - javascript
for this you can simply add two line spaces instead of one for example: this /** * decription * modes: * I am...
Read more >
Basics of JSDoc
To document JavaScript coding, you can add documentation comments to the code. ... Document the constructor with @class , @author , @since ,...
Read more >
Code completion | WebStorm Documentation - JetBrains
Additional information from JSDoc comments, TypeScript type ... in the middle are accepted) or invoke code completion after a dot separator.
Read more >
How to use JSDoc - Basics & Introduction - YouTube
In this video tutorial I'll be demonstrating how to use JSDoc which can be used to document and annotate your JavaScript code.
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