mark-wiemer-org / ahkpp

AutoHotkey Plus Plus (AHK++) - AutoHotkey v1 and v2 support for VS Code
https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus
Other
152 stars 10 forks source link

Wrong indentation on copy-paste #412

Open helperman opened 11 months ago

helperman commented 11 months ago

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.

mark-wiemer commented 11 months ago

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

Code_-_Insiders_g2mZYqbBFf

helperman commented 11 months ago

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

mark-wiemer commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

Removing this lines may fix copy-paste behavior.