I presume this is a 'Vscode being weird with ALL YAML' rather than Vscode
being weird specifically with Ansible YAML. You might want to check
something like a Vscode Stackoverflow and/or playing with your Vscode
plugins and config? If you take a completely clean portable mode vscode,
does is display the same problem? If not, it's your config, plugs or some
lingering settings _somewhere_.

I can take some dummy YAML and paste into a completely vanilla Vscode
install and it doesn't mess with the indentation at all:

---
- hosts: all
  become: yes

  tasks:
  - name: do some things
    dnf:
      name: packagename
      state: present

Can you run Vscode with all its plugins disabled and a completely default
config just in case you have plugins and config trampling on one another's
behaviours? (See:
https://code.visualstudio.com/docs/editor/extension-marketplace#_disable-an-extension
)

https://stackoverflow.com/questions/61978428/yaml-file-formatting-in-vscode
and/or
https://stackoverflow.com/questions/41790069/settings-to-copy-paste-with-correct-indentation-in-visual-studio-code
might be worth a read.


On Sat, 12 Aug 2023 at 15:45, Leon Khan <[email protected]> wrote:

> Greetings everyone,
>
> I hope you're doing well. I'm encountering an issue with formatting YAML
> source code in the Visual Studio text editor, and I'm seeking some
> assistance from the community.
>
> I have installed the YAML extension in Visual Studio, and while it's
> expected to automatically correct the formatting of YAML code upon pasting,
> I'm finding that this feature isn't working as intended. Despite having the
> YAML extension installed, the automatic formatting does not kick in when I
> paste YAML source code into the text editor.
>
> I've followed the recommended steps which include selecting the entire
> YAML file, right-clicking, and then choosing the "Format Document" option
> provided by the YAML extension. However, even after performing this action,
> the code formatting remains unchanged.
>
> I'm eager to streamline my workflow and ensure consistent formatting
> within my YAML files, so this issue is causing a bit of a hurdle for me. I
> would greatly appreciate any insights, suggestions, or solutions that the
> community might be able to provide regarding this matter. Perhaps there's a
> configuration step or an additional setting that I'm missing?
>
> Here is the screenshot of the YAML file in my VS code editor :
> [image: Screenshot from 2023-08-12 11-43-58.png]
>
>
>
> --
> Leon
> Fedora Open Source Volunteer
> IRC Handle : leonkhan
> "Contributing to open source, one line of code at a time."
> infrastructure mailing list -- [email protected]
> To unsubscribe send an email to
> [email protected]
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/[email protected]
> Do not reply to spam, report it:
> https://pagure.io/fedora-infrastructure/new_issue
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFUWKdXPdY7dCxm7EiRrLKySwgOi7S19grzFajD60aAJw3w8gQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFUWKdXPdY7dCxm7EiRrLKySwgOi7S19grzFajD60aAJw3w8gQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKtKohS9Y4xNk157gAtUOTujWFmmE%2BrCbrmwcfWxxLJwO9oXuw%40mail.gmail.com.

Reply via email to