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

[yaml] add space to surrounding pairs #112227

Closed
Tracked by #1
jvanderaa opened this issue Dec 10, 2020 · 4 comments
Closed
Tracked by #1

[yaml] add space to surrounding pairs #112227

jvanderaa opened this issue Dec 10, 2020 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@jvanderaa
Copy link

When working with YAML files (specifically usually for Ansible), I often will double click on a text entry, then type "{{ which will erase the text name. The space is habit from "{{ which then autopopulates }}" - completely awesome. So the process I have to go through now is to highlight the text, add "{{, arrow, space, ctrl-arrow, space that could be simplified. The space in between the braces and the variable name is the best practice on Ansible. It is part of the default ansible-lint rules as well.

@aeschli
Copy link
Contributor

aeschli commented Jan 6, 2021

Can you add a small code sample? What is the before and after state? What key is arrow in your description?

@aeschli aeschli added the info-needed Issue requires more information from poster label Jan 6, 2021
@jvanderaa
Copy link
Author

- name: Debug a var
  debug:
    msg: var_to_debug


- name: Debug after adding Jinja2 Formatting with Ansible best practice
  debug:
    msg: "{{ var_to_debug }}"

@jvanderaa
Copy link
Author

If you highlight the var_to_debug and then press " it will add the quotes around the whole thing. Then you enter {{ it will continue to add the closing items as well. The next step is to add the space between the braces and the var name. This is where VS Code then erases and enters a space instead of adding a space in a similar fashion.

@aeschli aeschli changed the title YAML Files - When highlighted text, have spacebar insert space like the double quotes or braces do [yaml] add space to surrounding pairs Jan 8, 2021
@aeschli
Copy link
Contributor

aeschli commented Jan 8, 2021

Ah, I see, you want surround the selected word with a space.

That doesn't fit well in the surrounding pairs feature which is single character base. Adding space to the surrounding pairs would solve your request but interfere with normal editing and add an inconsistency with other languages. I'm therefore closing the issue as we don't want to go that way.

However, there are multiple extensions that help with surrounding. Search for surround in the market place.

@aeschli aeschli closed this as completed Jan 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants