vscode-github-actions icon indicating copy to clipboard operation
vscode-github-actions copied to clipboard

Copy/Pasting YAML results in wrong indentation

Open sylr opened this issue 2 years ago • 10 comments

Describe the bug

Copy Pasting yaml when file is identified as GitHub workflow is messed up.

To Reproduce

https://github.com/github/vscode-github-actions/assets/153052/3e056158-fbe9-44f0-b987-6b3fc96c8f48

Expected behavior N/A

Screenshots N/A

Extension Version v0.25.8

Additional context Add any other context about the problem here.

sylr avatar Jul 05 '23 13:07 sylr

Do you have any YAML auto-formatter installed?

cschleiden avatar Jul 05 '23 15:07 cschleiden

I do have the redhat.vscode-yaml extension installed.

sylr avatar Jul 05 '23 15:07 sylr

I see the same behavior where the GitHub workflow doesn't copy/paste the same as a regular YAML file. I don't have another YAML extension installed.

I am on Windows 11 using the desktop version.

GitHub workflow (I noticed I can't find any way to paste it so that it is in the right place with just the paste, I have to do further editing to get it in the right place no matter where I place the cursor to paste): 1

Regular YAML file: 3

KetchupOnMyKetchup avatar Jul 13 '23 16:07 KetchupOnMyKetchup

I've experienced the same issue for months as well. It's a shame because I really like what the extension has to offer. I just leave it disabled.

djthornton1212 avatar Aug 14 '23 13:08 djthornton1212

I think this may be solved by the following setting

  "[github-actions-workflow]": {
    "editor.autoIndent": "keep"
  }

I spent some time tinkering with this incorrectly for the "[yaml]" settings group, not realizing that "[github-actions-workflow]" is considered a separate language. Does this work for others?

neil176 avatar Dec 14 '23 16:12 neil176

@neil176 Thank you! That fixed this for me as well.

djthornton1212 avatar Jan 04 '24 15:01 djthornton1212

"[github-actions-workflow]": {
    "editor.autoIndent": "keep"
  }

where to add this

Lekshmisr26 avatar Jan 23 '24 14:01 Lekshmisr26

@Lekshmisr26 In the VScode setting file settings.json, see https://code.visualstudio.com/docs/getstarted/settings#_settingsjson.

muzimuzhi avatar Jan 25 '24 11:01 muzimuzhi

Same awful experience here. The first line of a pasted block has the indentation always changed wrong, while the rest of the YAML block stays as is. I don't have any YAML-related extension active. I use YAML only in GitHub workflows.

danielniccoli avatar May 01 '24 09:05 danielniccoli

Same awful experience here. The first line of a pasted block has the indentation always changed wrong, while the rest of the YAML block stays as is.

I find an Undo (Cmd/Ctrl + Z) after pasting helps.

muzimuzhi avatar May 02 '24 01:05 muzimuzhi