没有不值得去解决的问题,也没有不值得去学习的技术!

Homestead.yaml Indentation Mismatches Homestead.yaml.example After Formatting in PhpStorm

After formatting the Homestead.yaml file in PhpStorm, the indentation is incorrect, as shown below

1. After formatting the Homestead.yaml file in PhpStorm, the indentation is incorrect, as shown below. See Figure 1.

After formatting the Homestead.yaml file in PhpStorm, the indentation is incorrect, as shown below
Figure 1
YAML

---
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. Check the format of Homestead.yaml.example: there is only a single space between – and map. See Figure 2.

Check the format of Homestead.yaml.example: there is only a single space between - and map
Figure 2
YAML

---
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. Reference: https://www.jetbrains.com.cn/help/phpstorm/2021.3/yaml.html . Settings – Editor – Code Style – YAML . The settings may be overridden by EditorConfig. Disable it. See Figure 3.

Reference: https://www.jetbrains.com.cn/help/phpstorm/2021.3/yaml.html . Settings - Editor - Code Style - YAML . The settings may be overridden by EditorConfig. Disable it
Figure 3

4. Format the code again. The formatting is now basically consistent with Homestead.yaml.example. See Figure 4.

Format the code again. The formatting is now basically consistent with Homestead.yaml.example
Figure 4
YAML

---
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


关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系