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

Typescript: Paste screws up format #32305

Closed
joaomoreno opened this issue Aug 11, 2017 · 3 comments
Closed

Typescript: Paste screws up format #32305

joaomoreno opened this issue Aug 11, 2017 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues under-discussion Issue is under discussion for relevance, priority, approach wont-fix
Milestone

Comments

@joaomoreno
Copy link
Member

This now feels a lot like what frustrated me 5 years ago in Visual Studio.

Not only paste now gets indentation wrong most of the time, it does it in two steps, requiring a double undo to go back.

This was even pointed out today in our HackerNews thread: https://news.ycombinator.com/item?id=14983231

@rebornix
Copy link
Member

I'll revisit indent on paste this milestone and see if we still keep it turned on. Pasting is way more complex than move lines or type because

  • the indent of first line is usually wrong as there might be additional leading whitespaces before pasting
  • for the rest of the line, we don't know whether their indentation are intentional or wrong.

Right now both Atom and we only try to adjust the indent of the first line and see if we need to adjust the offset to following lines. Besides, the user on hackernews is correct, without AST, auto indent can never be perfect.

@rebornix rebornix added the under-discussion Issue is under discussion for relevance, priority, approach label Aug 11, 2017
@rebornix rebornix added this to the August 2017 milestone Aug 11, 2017
@mjbvz mjbvz added the editor-autoindent Editor auto indentation issues label Aug 11, 2017
@mjbvz mjbvz modified the milestones: Backlog, August 2017 Aug 30, 2017
@mjbvz mjbvz added the bug Issue identified by VS Code Team member as probable bug label Nov 14, 2017
@uphlewis
Copy link

uphlewis commented Mar 8, 2019

Also been getting this issue since a recent update (some time in the last 2 months), but with PHP

@rebornix
Copy link
Member

rebornix commented Nov 3, 2020

This is due to the limited architecture (regex based indentation rules and only support limited code styles), we may want to consider using formatters if they exist for indenation adjustment (if interested, we can discuss in #19847).

For this particular issue, if the indentation rules are leading to more trouble than having no auto indent, you can set editor.autoIndent to advanced to disable the regex based indentation adjustment. As we don't have an easy good-enough fix for it, we close it for now and explore better solutions through issues like #19847.

@rebornix rebornix closed this as completed Nov 3, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues under-discussion Issue is under discussion for relevance, priority, approach wont-fix
Projects
None yet
Development

No branches or pull requests

4 participants