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

Wrong indentation on copy-paste #412

Open
helperman opened this issue Sep 24, 2023 · 6 comments
Open

Wrong indentation on copy-paste #412

helperman opened this issue Sep 24, 2023 · 6 comments
Assignees
Labels
bug something isn't working formatter code formatter issues question needs more clarity in order to take action

Comments

@helperman
Copy link

Description

I like to indent code of each separate hotkey in AHK-script.
It makes code more readable and clean.
The issue is when after copy-pasting a code with indentation the pasted code looses this indentation.

Reproduction steps

0000000735

Expected behavior

Indentation is the same as in a copied text.

Actual behavior

There is no indentation in a copied text.

@helperman helperman added the bug something isn't working label Sep 24, 2023
@mark-wiemer
Copy link
Collaborator

What happens when you run Format Document (Shift+Alt+F)? The document should look nice and indented:

Code_-_Insiders_g2mZYqbBFf

@mark-wiemer mark-wiemer added question needs more clarity in order to take action formatter code formatter issues labels Sep 30, 2023
@helperman
Copy link
Author

helperman commented Sep 30, 2023

Yes, Shift+Alt+F fixes indentation.
Therefore, the issue is pasting, not formatting.
I suspect trim spaces makes place when copying/pasting.

@mark-wiemer
Copy link
Collaborator

mark-wiemer commented Oct 11, 2023

I think format-on-paste is out of scope of this extension, maybe you have some other setting messing things up? Does this issue occur when you disable this extension and try to reproduce the issue?

@fade2gray
Copy link

fade2gray commented Oct 11, 2023

I also find this frustrating, that the indentation, included in the copied code is removed when pasted after a hotkey or label, but I do find that if you perform an 'undo' Ctrl+Z immediately after pasting, the indentation will be restored.

Note: Indent Code After Label in the settings doesn't appear to work - is this related?

@kyklish
Copy link
Contributor

kyklish commented Oct 12, 2023

Note: Indent Code After Label in the settings doesn't appear to work - is this related?

This setting was introduced for old formatter (when you hit Alt+Shift+F hotkey), it will format whole file, it didn't work with selected or pasted text.

@kyklish
Copy link
Contributor

kyklish commented Oct 12, 2023

Removing this lines may fix copy-paste behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working formatter code formatter issues question needs more clarity in order to take action
Projects
Status: No status
Development

No branches or pull requests

4 participants