在 PhpStorm 中格式化 Homestead.yaml 文件后,格式的缩进与 Homestead.yaml.example 不一致

1、在 PhpStorm 中格式化 Homestead.yaml 文件后,格式的缩进不正确,格式如下。如图1

图1

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa
    - ~/.ssh/id_rsa.pub

folders:
    -   map: E:/wwwroot/refactoring
        to: /home/vagrant/Code/refactoring

sites:
    -   map: refactoring.test
        to: /home/vagrant/Code/refactoring

databases:
    - homestead

features:
    -   mysql: true
    -   mariadb: false
    -   postgresql: false
    -   ohmyzsh: false
    -   webdriver: false

services:
    -   enabled:
            - "mysql"
#    - disabled:
#        - "postgresql@11-main"

#ports:
#    - send: 33060 # MySQL/MariaDB
#      to: 3306
#    - send: 4040
#      to: 4040
#    - send: 54320 # PostgreSQL
#      to: 5432
#    - send: 8025 # Mailhog
#      to: 8025
#    - send: 9600
#      to: 9600
#    - send: 27017
#      to: 27017

2、查看 Homestead.yaml.example 的格式,- 与 map 仅有一个空格。如图2

图2

---
ip: "192.168.56.56"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
      to: /home/vagrant/code

sites:
    - map: homestead.test
      to: /home/vagrant/code/public

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false

#services:
#    - enabled:
#        - "postgresql@12-main"
#    - disabled:
#        - "postgresql@11-main"

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

3、参考:https://www.jetbrains.com.cn/help/phpstorm/2021.3/yaml.html 。设置 – 编辑器 – 代码样式 – YAML 。设置可能被 EditorConfig 重写。禁用掉。如图3

图3

4、再次格式化代码。格式与 Homestead.yaml.example 基本上保持一致。如图4

图4

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
  - ~/.ssh/id_rsa
  - ~/.ssh/id_rsa.pub

folders:
  - map: E:/wwwroot/refactoring
    to: /home/vagrant/Code/refactoring

sites:
  - map: refactoring.test
    to: /home/vagrant/Code/refactoring

databases:
  - homestead

features:
  - mysql: true
  - mariadb: false
  - postgresql: false
  - ohmyzsh: false
  - webdriver: false

services:
  - enabled:
      - "mysql"
#    - disabled:
#        - "postgresql@11-main"

#ports:
#    - send: 33060 # MySQL/MariaDB
#      to: 3306
#    - send: 4040
#      to: 4040
#    - send: 54320 # PostgreSQL
#      to: 5432
#    - send: 8025 # Mailhog
#      to: 8025
#    - send: 9600
#      to: 9600
#    - send: 27017
#      to: 27017

永夜