代码样式 – 永夜 https://www.shuijingwanwq.com 没有不值得去解决的问题,也没有不值得去学习的技术! Wed, 04 Jan 2023 11:51:05 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.0 在 PhpStorm 中格式化 Homestead.yaml 文件后,格式的缩进与 Homestead.yaml.example 不一致 https://www.shuijingwanwq.com/2023/01/04/7324/ https://www.shuijingwanwq.com/2023/01/04/7324/#respond Wed, 04 Jan 2023 11:51:05 +0000 https://www.shuijingwanwq.com/?p=7324 浏览量: 121 1、在 PhpStorm 中格式化 Homestead.yaml 文件后,格式的缩进不正确,格式如下。如图1
在 PhpStorm 中格式化 Homestead.yaml 文件后,格式的缩进不正确,格式如下

图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
查看 Homestead.yaml.example 的格式,- 与 map 仅有一个空格

图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
参考:https://www.jetbrains.com.cn/help/phpstorm/2021.3/yaml.html 。设置 - 编辑器 - 代码样式 - YAML 。设置可能被 EditorConfig 重写。禁用掉

图3

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

图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



]]>
https://www.shuijingwanwq.com/2023/01/04/7324/feed/ 0