VSCode 常用的PHP插件及配置


一、在程序中打斷點調試:PHP Debug

二、高級自動完成和重構支持(代碼智能提示):PHP IntelliSense

  配置:

  "php.suggest.basic": false,  // 插件作者建議禁用VS代碼內置的PHP智能感知設置php.suggest.basic,以false避免重復的建議

  "php.validate.executablePath": "D://phpStudy//PHPTutorial//php//php-7.2.1-nts//php.exe"   //指向php可執行文件(最少在php7.0版本以上)

三、Ctrl + S自動格式化php代碼:phpfmt - PHP formatter

  默認使用 PSR2 規范

四、Ctrl + S自動格式化php代碼:php cs fixer

  配置:

  "php-cs-fixer.onsave": true,  //Ctrl  + S 時格式化php代碼

  "php-cs-fixer.formatHtml": true  //格式化.php文件中的html代碼(html、css、js)

五、生成函數的注釋:PHP DocBlocker(/**)

六、生成自定義文件頭信息:vscode-fileheader(Ctrl + Alt + I)

七、Ctrl+; 行尾自動添加分號:macros

  1.配置:

  "macros": {
    "end_semicolon": [ // 末尾加分號
      "cursorLineEnd",
      {
        "command": "type",
        "args": {
          "text": ";"
        }
      }
    ]
  }
 
  2.keybindings.json 中設置按鍵綁定:
  [{
    "key": "ctrl+;",
    "command": "macros.end_semicolon"
  }]


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM