Skip to content
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

'reindent all lines' removes leading space in comment #19142

Closed
aeschli opened this issue Jan 24, 2017 · 5 comments
Closed

'reindent all lines' removes leading space in comment #19142

aeschli opened this issue Jan 24, 2017 · 5 comments
Assignees
Labels
editor-autoindent Editor auto indentation issues *out-of-scope Posted issue is not in scope of VS Code typescript Typescript support issues under-discussion Issue is under discussion for relevance, priority, approach

Comments

@aeschli
Copy link
Contributor

aeschli commented Jan 24, 2017

Testing #19091:
In a typescript file:

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';
class A {
}
  • use the 'Reindent all lines' command
  • check out the file comment. The space before '*' has been removed
/*---------------------------------------------------------------------------------------------
*  Copyright (c) Microsoft Corporation. All rights reserved.
*  Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
@rebornix
Copy link
Member

Block comment's indentation is currently handled by onEnterRules and not filtered out in Indentation Rules. There are actually two ways to mitigate this issue

  1. Honor onEnterRules in Reindent lines, which is a breaking change
  2. Enhance Indentation Rules for TypeScript. The indentation rule set I mentioned in 'reindent all lines' and formatter have different formatting strategies #19140 (comment) still doesn't fix this problem. A proper fix is likely filtering block comments in unIndentPattern if possible.

@rebornix rebornix added editor typescript Typescript support issues labels Jan 24, 2017
@rebornix rebornix added the under-discussion Issue is under discussion for relevance, priority, approach label Apr 19, 2017
@rebornix rebornix added the editor-autoindent Editor auto indentation issues label Jun 7, 2017
@alexdima alexdima removed the editor label Nov 23, 2017
@ghost

This comment has been minimized.

@hexpunk
Copy link

hexpunk commented Oct 11, 2018

FWIW, this affects pretty much all languages with doc comments, not just typescript. I experienced this bug today in a PHP file.

@jpw
Copy link

jpw commented Jun 12, 2019

Yes, I'm not sure the typescript label is relevant here.

My use case is I'm about to sort out lots of formatting issues in a rough-looking ES6 codebase that does at least have JSDoc comments, and I think I cant use "Reindent lines" to do so without messing up the comments (thereby annoying linters, and/or changing the code style). I will have to subsequently do a regexp find & replace on all the block comments (also regexp may vary per file), or a lot of copy & pasting around :(

Also see this stackoverflow issue (I am not the author of that).

@mjbvz mjbvz added the *out-of-scope Posted issue is not in scope of VS Code label Oct 11, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 11, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-autoindent Editor auto indentation issues *out-of-scope Posted issue is not in scope of VS Code typescript Typescript support issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

6 participants